fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int i = 125;
  8.  
  9. // this prints out 125
  10.  
  11. cout << "first loop is on" << endl;
  12.  
  13. do {
  14. cout << "i = " << i << endl;
  15. } while (i<42);
  16.  
  17. // this prints out nothing
  18.  
  19. cout << "second loop is on" << endl;
  20.  
  21. while (i<42)
  22. {
  23. cout << "i = " << i << endl;
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
first loop is on
i = 125
second loop is on