// This program demonstrates the strcmp and atoi functions. #include #include // For strcmp #include // For atoi #include // For isdigit using namespace std; bool isEntirelyDigits(char * ); bool isEntirelyDigitsP(char * ); int main() { // Array used to read numbers in string form. const int LENGTH = 20; char input[LENGTH]; int total = 0, // Running total count = 0; // Number of numbers read double average; // Average // Read numbers and computer total of numbers. cout << "This program will average a series of numbers.\n"; cout << "Enter the first number or Q to quit: "; cin.getline(input, LENGTH); while((strcmp(input,"Q")!= 0)&&(strcmp(input,"q")!= 0)) { //make sure that input is numeric (not just not a Q or q) if (isEntirelyDigitsP(input)) { // Keep a running total. total += atoi(input); // Keep track of how many numbers are entered. count++; } else cout<<"This input is non numeric and is being ignored." <