#include #include using namespace std; int main() { int numBooks = 0; // # of books for this order int totalNumBooks = 0; // total # of books ordered by customer bool userWantsToExit = false; // flag variable to exit while loop while (userWantsToExit == false) // or while (!userWantsToExit) { cout << "Enter number of books (-1 to quit): "; cin >> numBooks; if (numBooks == -1) // -1 is sentinel value to exit loop { userWantsToExit = true; } else if (numBooks >= 0 && numBooks <= 10) { totalNumBooks += numBooks; } else { cout << "Invalid input." << endl; } } cout << "The total number of books ordered is " << totalNumBooks << endl; system("pause"); return 0; }// end of main