Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Negative sum. I do not understand how to write the program. work on this project, demonstrate to the lab instructor looking up the value of
Negative sum. I do not understand how to write the program.
work on this project, demonstrate to the lab instructor looking up the value of a variable by hovering over it Create a ). sum with a single file sum.cpp. Your program should ask the user for a sequence of numbers until the user inputs e (zero) and then the program should print the sum of negative numbers that the user input. Here is an example dialog Input sequence of integers (zero to stop): 43 -20 10 45 1e0 -1e The sum of negative numbers is: -25 You are not allowed to use functions, arrays or other constructs that we have not yet studied Hint: You need to use iterate-and-keep-track idiom vhlle or do-whi expression check if thi the sum of negative numbers. Make sure to initialize this variable. In the loop, with an if, check if the number is negative and, if yes, add it cxample of selecting the maximum number It is very similar to what you need to implement. ile would be a good construct to use. Consider a single number in each iteration In the while is number is not zero. If not- proceed, if yes - stop evaluation and print out the result Declare a variable where your program will collect to the sum. Look at this Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started