![]() |
Need help for C++ programming
Hi,
I am back again with another problem. Hope someone can help. I can get the program to run, but I cannot figure out how to end the program when sales < than 0 for each section. The problem is this: Create a program that displays the sum of the sales amounts made in each of four regtions (North, East, South, and West) during a 3 month period. The program also should display the total sales made during the three months. The C++ code should allow the user to enter 4 sets (one set for each region) of 3 sales amounts (one sales amount for each month). The program should display each region's total sales for the 3-month period, and the company's total sales for the 3-month period. Use the following four sets of data to test the program: 2000, 4000, 3000 2000, 5000, 5000 3000, 2000, 1000 4000, 1000, 6000 Here is my program so far: Code:
|
Re: Need help for C++ programming
Can anyone give me an idea of what to try? PLEASE, PLEASE, PLEASE! :freak:
Thank you for your time, Lori |
Re: Need help for C++ programming
if i understand correctly what you want try this
Code:
//enter sales amounts for North region |
Re: Need help for C++ programming
Where were u yesterday when I needed you, lol. I do think this will work. I was using the wrong loop command I guess. Plus, I did not know that you could use two different variable in one condition. I will try this and let you know how it goes. Thank you so much.
Lori |
Re: Need help for C++ programming
OK, this works great, but shouldn't the program go to the very end as soon as a negative number is entered. Is this even possible?
|
Re: Need help for C++ programming
You may be back with another problem but the title you have given to your problem is nothing different from your other problem.
Try give better title for good responses. See your latest thread - Need help for C++ programming I was about to close that. |
Re: Need help for C++ programming
Quote:
if (northRegionSales<0) exit(1); put it under all cin<<nortRegionSales; |
Re: Need help for C++ programming
How do I change the post title? I don't see a way to edit it.
|
Re: Need help for C++ programming
Quote:
|
Re: Need help for C++ programming
What does the "exit (1) in the following mean? We have not covered that in computer class yet.
if you want to terminate your program immediately you can do this: if (northRegionSales<0) exit(1); put it under all cin<<nortRegionSales; |
| All times are GMT +5.5. The time now is 11:53. |