0
difference between someone
#include <iostream> using namespace std; int main() { int x = 1; do { cout <<"this is loop" << endl; } while (x <= 15); return 0; } and #include <iostream> using namespace std; int main() { int x = 1; do { cout <<"this is loop" << endl; x++; } while (x <= 15); return 0; } the first one loop shows time limit exceed at the end of the line and the 2nd one showing correct (msg) at 15 times
1 Answer
+ 1
you're missing x++; in the first one, it times out because it won't stop printing "this is a loop" because x never changes.