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
1. A truck leaves a stop sign and accelerates uniformly over a time of 5.21 seconds for a
Rufina [12.5K]

Answer:

1, is 21.11 meters per second.

110/5.21

Explanation:

3 0
3 years ago
Based on the following passage on construction technology during the Middle Ages, why might a worker not be allowed to join a gu
olya-2409 [2.1K]

Answer:

He was not born into a family of skilled laborers

Explanation:

6 0
3 years ago
Press ____ to select the entire worksheet.<br> F1<br> F4<br> ALT+A<br> CTRL+A
andreev551 [17]
<span>The answer is CTRL + A, this selects whole worksheet (A means all). In computing, a Control key is a transformer key which, when pushed in combination with one more key, achieves a singular operation (for example, Ctrl + A; like the Shift key, the Control key infrequently achieves any purpose when pushed by itself.</span>
5 0
3 years ago
In ipv4 addressing, an ip address whose first octet is in the range of 192–223 belongs to a class ____ network.
pishuonlain [190]

I guess the correct answer is class C network.

In IPv4 addressing, an IP address whose first octet is in the range of 192–223 belongs to a class C network.

4 0
3 years ago
what's that one game where you have powers like telekenesis, it's also an open world GTA type of game
torisob [31]
Is it infamous for the playstation 3?
4 0
3 years ago
Read 2 more answers
Other questions:
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • The purpose of a capacitor unit in a vacuum cleaner is to
    12·1 answer
  • Which of the following terms describes surgery through a small incision in the abdomen?
    11·1 answer
  • If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have? A. Two B. One C. Four D. Thr
    12·1 answer
  • If you're unsure of what chart to use for a set of data, what feature does Excel include that will help you to decide?
    7·1 answer
  • It is unlawful in the State of Florida for any person, ______________________, to be a passenger in the front seat of a motor ve
    7·1 answer
  • Apps are designed by___.
    11·2 answers
  • Computer instructions are converted to binary when executed. Binary numbers use which set of digits?
    10·1 answer
  • Dr. Wayne is trying to developing techniques to cure Parkinson’s disease by inserting genetic material into patients’ cells to c
    12·1 answer
  • Modify your main.c file so that it allocates a two dimensional array of integers so that the array has 20 rows of 30 integers in
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!