You are on page 1of 1

#include <iosteam.h> #include <conio.

h> main(void) { int num; char choice; bool quit = false; clrscr9); do { cout << "Enter a positive number: "; cin >> num; if (num <= 0) { cout << "Number must be positive; try again (Y/N): "; cin >> choice; if (choice != 'Y') quit = true; } } while (num <= 0 && quit == false); if (quit == false) cout << "The number you entered is " << num << " "; else cout << "You did not enter a positive number"; getch(); return 0; }

You might also like