// Print out a list of powers of 2. #include #include using namespace std; int main() { const int UPPER_LIMIT = 100; int num = 1; // counter char choice; // used to get user input while (num <= UPPER_LIMIT) { cout << "2 to the " << num << " power is " << pow(2, num) << endl; cout << "Should I go on? [y/N]: "; cin >> choice; if (choice == 'N' || choice == 'n') break; // (try replacing with 'continue') num++; } cout << "Goodbye!" << endl; return 0; }