// This program is to show the basic do-while statement // and to show how to get only the first character from // a line of input. #include using namespace std; int main() { int loop = 0; char userInput, junk; do { loop++; cout << "This is loop " << loop; // Prompt for input cout << " Continue (y,n)? "; cin.get(junk); userInput = junk; while (junk != '\n') cin.get(junk); } while (userInput != 'n'); cout << endl << "Goodbye" << endl; }