Use the break keyword to provide the user with the option of quitting the data entry
#include <iostream> using namespace std; int main(void) { int num; char choice; cout << "Enter a positive number: "; cin >> num; while (num <= 0) { cout << "Number must be positive; try again (Y/N): "; cin >> choice; if (choice == 'Y') { cout << "Enter number: "; cin >> num; } else break; } cout << "The number you entered is " << num << " "; return 0; }