// Whilesum.cpp (c) Kari Laitinen // http://www.naturalprogramming.com/ // 1997-??-?? File created. // 2013-11-06 Last modification. #include #include using namespace std ; int main() { int integer_from_keyboard = -1 ; int sum_of_integers = 0 ; cout << "\n This program calculates the sum of integers you" "\n type in from the keyboard. By entering a zero you" "\n can terminate the program. \n\n" ; while ( integer_from_keyboard != 0 ) { cout << " Current sum: " << setw( 8 ) << sum_of_integers << " Enter an integer: " ; cin >> integer_from_keyboard ; sum_of_integers = sum_of_integers + integer_from_keyboard ; } }