// Program to add numbers until a -1 is input, version 2 // Michael Rothstein // 01/30/2014 #include using std::cin; using std::cout; using std::endl; int main() { int total = 0; // Contains the sum of all read in numbers. while (1){ int number; cin >> number; if( number == -1 ) break; total += number; } cout << "Sum is " << total << endl; }