[QUOTE=flasp;1451454]The assignment says "Write a program that asks the user to type in numbers. After each entry, the program should report the cumulative sum of the entries to date. The program should terminate when the user enters 0."
I have partly been succesfull I guess. But I dont know how to make the program so it doesnt quit when I press the first number. And for it to actually quit when I press 0.. I hope a friendly soul can help me out.[/QUOTE]
You might want to decompose the problem in small sub-problems. So reading this assignment, you find out that you are required to do a few things :
get a number from the user
compute a cumulative sum
[*]terminate the program when the user enters 0
You already achieved the first point with the usage of std::cin >> numbers. (and I'll make a note for myself to make sure the user entered a number. What would happen if the user entered a character ? But that's something you'll worry about afterwards).
For the second point, it seems you will need another variable to hold your running sum. Probably an int.
The third item is the one you're struggling with. So let's try to decompose it into even smaller problems. How do you terminate a program ? There are a few ways to do it, but it should normally terminate when you [I]return[/I] from your main function. And how do you return from your main function, well ...