#include using namespace std; // reads some integers from keyboard ending with -1, and adds them up int main() { int num, sum; sum = 0; // initialize sum cout << "Please enter integers to add up (enter -1 to finish): "; cin >> num; // read the first number while (num != -1) { sum += num; cin >> num; // read the next number } cout << "the sum is: " << sum << endl; return 0; }