#include #include using namespace std; // reads 10 integers from keyboard, checks validity of being integer and adds them up // problem with invalid numbers in sum10validnums.cpp is fixed int main() { int num, sum, count; string s; sum = 0; //initialize sum cout << "Please enter 10 integers to add up: "; for (count=1; count <= 10; count++) { if (cin >> num ) // read the next number and checks if it is a valid integer { cout << num << " is a valid entry" << endl; sum += num; // add it to the sum if valid } else // if not valid { cout << "entry #" << count << ": '" << s << "' is an invalid entry" << endl; } } cout << "the sum is: " << sum << endl; return 0; }