1
0

dowhile.cpp 384 B

123456789101112131415161718
  1. // dowhile.cpp -- exit-condition loop
  2. #include <iostream>
  3. int main()
  4. {
  5. using namespace std;
  6. int n;
  7. cout << "Enter numbers in the range 1-10 to find ";
  8. cout << "my favorite number\n";
  9. do
  10. {
  11. cin >> n; // execute body
  12. } while (n != 7); // then test
  13. cout << "Yes, 7 is my favorite.\n" ;
  14. // cin.get();
  15. // cin.get();
  16. return 0;
  17. }