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
Karo-lina-s [1.5K]
3 years ago
10

I need a C++ program to ask the user to put in different numbers until zero is pressed then the program counts the numbers that

are put in and finds the sum of the numbers and the negative numbers.
Computers and Technology
1 answer:
frozen [14]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

int main()

{

int input = 0;

int count = 0;

int sum = 0;

int sumNegative = 0;

while (true) {

 cout << "Enter a number: ";

 cin >> input;

 if (input == 0) break;

 count++;

 sum += input;

 if (input < 0) {

  sumNegative += input;

 }

}

cout << "Count of the numbers: " << count << endl;

cout << "Sum of all the numbers: " << sum << endl;

cout << "Sum of the negative numbers: " << sumNegative << endl;

}

Explanation:

Your requirements regarding the sum and the negative numbers was a bit vague so I just did something you can probably adjust easily to your liking.

You might be interested in
In Interactive Charting, which chart type allows you to chart the current spread between a corporate bond and a benchmark govern
harkovskaia [24]

Answer:

c. Bond Spread

Explanation:

An interactive chart is used to show all the details in the chart and the user can extend or shrink the details that is presented in the charts by using the slider control.

The bond spread in an interactive is a chart that is used to compare and chart the current spread between the corporate bond as well as the benchmark government bond.

8 0
3 years ago
Does anyone know a NC wise owl password I can use, it's an emergency!! I can't ask my school because they are closed and I need
snow_tiger [21]
The password would be Apple 123
6 0
3 years ago
What is true about music from the Romantic period?
avanturin [10]
The answer to the given question above is the third option: <span>It was longer and less constrained than the music of the Classical period. The Romantic Period in music actually has more freedom in design and form. During this period, music were even more artistic and intellectual as well. Romantic Period occurred the late 18th century until early 19th century.</span>
8 0
3 years ago
Read 2 more answers
Paano nakatutulong ang teknolohiyang pangkomunikasyon sa pangangalap ng impormsyon
Makovka662 [10]

Answer:

Yes correct. Absolutely breathtaking. You should create poetry with your writing skills.

6 0
3 years ago
What are the functions of an input device​
marshall27 [118]

Answer:

To feed the computer with data/instructions

6 0
3 years ago
Read 2 more answers
Other questions:
  • What kind of voltage do solar cells generate? Solar cells produce ______ voltage which is not usable by most household appliance
    15·1 answer
  • All of the following are typical characteristics of internet predators, except white. male. between the ages of 18 and 35. high
    7·1 answer
  • Using C++, Write a full class definition for a class named Acc1, containing no constructors, functions, or data members (i.e., a
    12·2 answers
  • Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers to the e
    9·1 answer
  • Consider the following declaration.int[] beta = new int[3];int j;Which of the following input statements correctly input values
    11·1 answer
  • By default, EC2 instances pull SQS messages from an SQS queue on a FIFO basis.
    6·1 answer
  • If two different devices try to transmit to a common device at the same time, switches suffer from a problem in the collision do
    13·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    7·2 answers
  • In the ISO/IEC 27002 framework, _________________ describes the use and controls related to encryption.
    15·1 answer
  • Which popular file format loses some of the information from the image? JPEG TIFF RAW NEF
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!