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
Shapes in the Shapes gallery can be combined to show relationships among the elements.
LUCKY_DIMON [66]
Yes, this statement is true.
Actually this statement is about using Microsoft PowerPoint, shapes in the shape gallery can be combined to show relationships among the elements.
In the shape gallery of Microsoft PowerPoint, there are many shapes such as oval, square, rectangle, star, line and many more. One can use any shape to illustrate the concept or to show relationship between something.
8 0
3 years ago
_______ is the remote performance of medical exams, consultations, health monitoring and analysis using special medical equipmen
laila [671]

Answer:

eHealth.

Explanation:

eHealth or electronic health is a digital medical platform used to connect individuals to medical treatment they so need but can not receive due to certain barriers.

The eHealth platform uses modern day technology for consultation, examination of patient's health, prescription of medication etc. But it refers patients to trusted medical facilities when the situation is critical.

All these are done electronically through the internet and has eliminated the boundaries of geographical location.

8 0
3 years ago
The _____ is a storage location for text awaiting pasting.
Tanzania [10]
What's your answers? 
8 0
3 years ago
Read 2 more answers
What are storage devices? write two such devices​
Ira Lisetskai [31]

Answer:

two types of storage devices used with computers a primary storage device such as r a m and the secondary storage device such as a hard drive secondary storage can be removable internet or external

Explanation:

hope it is helpful for you please make me brilliant only if you like this answers

8 0
2 years ago
Read 2 more answers
(tco 5) how many 4-bit parallel adders are required to add the numbers 5,345 and 3,892? explain how you got your answer.
Igoryamba
The sum is 9237. To express this as binary requires log(9237)/log(2) bits ≈ 13.2 bits, rounded up at least 14 bits. (You can check: 2^13 is not enough, 2^14 is enough)

So you need four 4-bit adders, giving you 16 bits resolution.
7 0
3 years ago
Other questions:
  • Which online text source would include a review of a new TV show?
    9·2 answers
  • 2. What does the Action tool allow you to do in Microsoft PowerPoint? (20 points)
    12·2 answers
  • The ________ simulates your work area.
    14·1 answer
  • . String literals are surrounded by _____ quotes
    14·1 answer
  • What color does Sam obtain when he mixes white with a color? Sam is painting a landscape and needs to paint the sky light blue.
    9·2 answers
  • What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
    10·2 answers
  • When the "swen" virus infected someone's system, it made significant changes to the registry that caused it to be extremely diff
    11·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    7·1 answer
  • Name any two procedure oriented programming language​
    15·1 answer
  • Which of the following data types can hold a fractional (decimal) number?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!