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
Leviafan [203]
3 years ago
10

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Sample Run 1 Enter an integer, the input ends if it is 0: 1 2 -1 3 0 The number of positives is 3 The number of negatives is 1 The total is 5.0 The average is 1.25 Sample Run 2 Enter an integer, the input ends if it is 0: 0 No numbers are entered except 0 Sample Run 3 Enter an integer, the input ends if it is 0: 2 3 4 5 0 The number of positives is 4 The number of negatives is 0 The total is 14 The average is 3.5 Sample Run 4 Enter an integer, the input ends if it is 0: -4 3 2 -1 0 The number of positives is 2 The number of negatives is 2 The total is 0 The average is 0.0
Computers and Technology
1 answer:
GarryVolchara [31]3 years ago
5 0

Answer:

<em>C++</em>

////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

#include <vector>

using namespace std;

int main() {

  vector<int> v;

   int n = 1;

   while (n != 0) {

       cout<<"Enter an integer, the input ends if it is 0: ";

       cin>>n;

       v.push_back(n);

   }

   cout<<endl;

   ///////////////////////////////////////////////////////////

   int sum = 0;

   int num_positives = 0, num_negatives = 0;

   for (int i=0; i<v.size()-1; i++) {

       if (v[i] > 0)

           ++num_positives;

       else

           ++num_negatives;

           

       sum = sum + v[i];

   }

   //////////////////////////////////////////////////////////

   cout<<"The number of positives is "<<num_positives<<endl;

   cout<<"The number of negatives is "<<num_negatives<<endl;

   cout<<"The total is "<<sum<<endl;

   cout<<"The average is "<<(float)sum/(v.size()-1);

   ///////////////////////////////////////////////////////////

   return 0;

}

You might be interested in
You are unpacking and setting up workstations
Anestetic [448]

Answer:

For setting up workstations in classrooms, one end of cables connected into the built in NIC and other end will be connected to a drop.

Explanation:

A drop will be used for connectivity in this case, which will work as connection point in a network. Drops are just like outlets in wall having  Ethernet Jacks where a network device or system can be plugged into it.

8 0
3 years ago
The FTC found CardSystems Solutions and its predecessors __________ the FTC Act 15, U.S.
umka21 [38]

Take because it is lit

6 0
3 years ago
A file to which information is written is referred to as a(n) ____ file.
Iteru [2.4K]
The answer is <span>output.  </span>A file to which information is written is referred to as an output file.  It is  <span>a computer </span>file<span> that contains data that are the </span>output<span> of a device or program. </span>
4 0
3 years ago
14. The Internet may best be compared to a/an
finlep [7]
From that particular list, the item that best compares to the internet
is B. a large network of roads.
7 0
3 years ago
Read 2 more answers
Helen has no experience in security. She would like to earn a certification that demonstrates that she has the basic knowledge n
rewona [7]

Answer:

Option C. Security+ is the correct answer.

Explanation:

8 0
3 years ago
Other questions:
  • Mike wants to build an amplifier. Which technology can he use?
    15·1 answer
  • Mm
    10·1 answer
  • By generating and delivering timely and relevant information supported by networks, _____ creates new opportunities for conducti
    15·1 answer
  • Whats the difference between search engine and web browser?
    6·2 answers
  • 1. Access and PowerPoint are not included in all configurations of Microsoft Office 2013.
    14·1 answer
  • Which website allows you to host your podcast for at a cost that includes your domain name?
    9·2 answers
  • Where (what memory location) is the data read from for the following code:
    12·1 answer
  • I'm gonna get grounded for getting a 52 on my test :(
    13·1 answer
  • graham drove 39 2/3 miles in 1 1/3 hours. What is the unit rate for miles per hour? Use a pencile and paper. Describe a situatio
    10·1 answer
  • Who is willam afton from five nights at freddy
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!