// Oldham, Jeffrey D. // 1999 Sep 07 // CS 1320 // // Program to Add Many Integers // input <- Prompted by the program, the user types zero or more integers. // output-> The integers' sum is printed. // We are still constructing the loop. #include int main() { int second_integer; // We move this out of the loop because we // want the integer declared only once, not // once per loop. while (/* add test of when to stop later */) { cout << "Please enter an integer: "; cin >> second_integer; } // This sum is wrong. We need to sum the integers the user types // in. In the next program, we will have the variable "sum" will // contain the running total of all integers already typed in. int sum = first_integer + second_integer; cout << "The sum is " << sum << ".\n"; return 0; }