Answered step by step
Verified Expert Solution
Link Copied!

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.
image text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Why is customer profitability analysis important?

Answered: 1 week ago

Question

Draw a labelled diagram of the Dicot stem.

Answered: 1 week ago

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago