1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elenna [48]
3 years ago
10

Write a C++ program that takes as input a list ( an array) of n integrers and finds the number of negative inetgers inthe list (

array ).
Side Note: The problem did not come out ofthis book but the information that I study is from this book. And Iam not getting how to write the program.
Computers and Technology
1 answer:
telo118 [61]3 years ago
6 0

Answer:Following is the program for the count of negative integers in an array:-

#include <bits/stdc++.h>  

using namespace std;

int main()

{

   int n,count=0;//declaring 2 variables n and count and initializing count with 0..

   cout<<"Enter the size of the array"<<endl;

   cin>>n;//prompting the size of the array...

   int negative_nums[n];//array of integers of size n..

   cout<<"Enter the numbers"<<endl;

   for(int i=0;i<n;i++)

   cin>>negative_nums[i];//prompting elements of the array...

   for(int i=0;i<n;i++)//iterating over the array....

   {

       if(negative_nums[i]<0)// if integer in the array at ith position is negative...  

       count++;// increasing the count...

   }

   cout<<"The number of negative numbers are "<<count<<endl;//printing the count of negative integers...

   return 0;

}

Explanation:

1. In the program i have taken a count integer initializing it with 0

2. Iterating over the array.

3. If the element at ith position is less than zero then increasing the count by 1.

4.Printing the count of negative integers in the array.

You might be interested in
A list of sources used for in-text citations that appears at the end of a document is called:
jolli1 [7]
The correct answer is Works cited page
5 0
2 years ago
Which access object(s may be used when creating a lookup field to select valu?
BabaBlast [244]
What the heck is your username?
8 0
3 years ago
An open intersection is one that
alekssr [168]

 open intersection is one without traffic control signs or signals. When you enter one, you must yield the right-of-way if: A vehicle is already in the intersection. You enter or cross a state highway from a secondary road. hope this helped


4 0
3 years ago
Read 2 more answers
Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win
Pepsi [2]

Answer:

Following are the code in the C++ Programming Language.

//define class and inherited the parent class

class WindowWithBorder : public Window

{

//access modifier

private:

//set integer variable

int borderWidth;

//set integer variable

int windowWidth;

//access modifier

public:

//definition of the constructor that accept an integer type argument

WindowWithBorder(int);

//definition of the function

int getUseableWidth();

};

//set constructor outside the class

WindowWithBorder::WindowWithBorder(int y)

{

//initialization in integer variable from function

windowWidth = getWidth();

//initialization in integer variable from the argument list

borderWidth = y;

}

//set function from outside the class

int WindowWithBorder::getUseableWidth()

{

//return output

return windowWidth - borderWidth;

}

Explanation:

Here we define a class "WindowWithBorder" which inherit their parent class "Window", inside the class.

  • Set two integer data type private variables "borderWidth" and "windowWidth".
  • Write the definition of the "windowWidth" class constructor that accept the integer type argument list.
  • Write the definition of the function "getUseableWidth()" which is integer type.

Then, we define constructor outside the class which accept the integer type argument list "y" inside it.

  • we initialize in the variable "windowWidth" from the function "getWidth()".
  • Initialize in the variable "borderWidth" from the argument of the constructor.

Finally, we define function in which we perform the subtraction of the variable "windowWidth" from the variable "borderWidth" and return it.

5 0
3 years ago
Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
kicyunya [14]
The answer is Fourth-generation language (4GL).  <span>Sql is an example of a 4GL category programming language.  </span>SQL<span> is considered a Fourth-generation </span>language<span> (</span>4GL), whereas Java and C++ are third-generation languages<span> (3GLs). Fourth-generation </span>languages<span> are programming  </span>languages<span> that are closer to human </span>language<span> than the high-level </span>languages<span>  like Java.</span>
8 0
3 years ago
Other questions:
  • Attacker player X is standing still on a corner kick, as the ball is played, he jumps up with his arms flailing above his should
    8·1 answer
  • Help with this chart please
    9·1 answer
  • The partners of a small architectural firm are constantly busy with evolving client requirements. To meet the needs of their cli
    11·1 answer
  • Justin has started a lawn mowing business in his neighborhood. He is running a weed-pulling special this month. What is the most
    8·2 answers
  • _KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
    12·1 answer
  • Which of the following is true of binary files?
    6·2 answers
  • 9.4 Code Practice: Your task is to determine whether each item in the array above is divisible
    14·1 answer
  • Greg wants to check the amount of requests his website receives. What test can he use?
    6·1 answer
  • Do OBS mic filters apply everywhere? Such as discord and other apps similar. Or is it just on streaming?
    15·1 answer
  • The arrangement of keys on a keyboard, QWERTY reflects the keyboard layout by ________. Group of answer choices using the letter
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!