/* testrep8.cpp CIS 150 6/7/2005 David Klick Demonstration of a sentinel-controlled loop. */ #include using std::cout; using std::cin; int main(void) { int num; // variable for user input num = 0; // make sure variable not set to sentinel value do { cout << "Enter integer (-999 to exit): "; cin >> num; } while (num != -999); return 0; } /* Sample output: Enter integer (-999 to exit): 54 Enter integer (-999 to exit): -200 Enter integer (-999 to exit): -999 */