+ 2

How to program while loop in cpp in sololearn?

19th May 2017, 8:24 AM
Subham Chakrabertty
Subham Chakrabertty - avatar
8 Answers
+ 4
The loop will have following syntex:- while(condition) { statements; } Here is the description for you:- 1. Here condition is the conditions which you are applying for the integer or float value. 2.Do not forget to miss the updatation part in statements otherwise it will cause error and will become an infinite loop
19th May 2017, 3:56 PM
Harsh
Harsh - avatar
+ 6
while ( condition ) { statements; } // In the normal way =^=
19th May 2017, 8:29 AM
Maz
Maz - avatar
+ 6
try this bool runLoop = true; while(runLoop == true) { cout << " i am looping"; } this creates a loop that runs forever. you could prompt the user to end the loop inside said loop and if they say yes. you would set runLoop to false. This would end the loop.
19th May 2017, 3:49 PM
jay
jay - avatar
+ 4
you didnt just type what maz said word for word did you?
19th May 2017, 3:45 PM
jay
jay - avatar
+ 3
not sure you wouldve got to this yet in the course. Pretty sure they cover it
19th May 2017, 8:46 AM
jay
jay - avatar
+ 3
while(true){ cout << "some text" << endl; }
19th May 2017, 5:05 PM
CommentSense
CommentSense - avatar
+ 2
its not working the said way maz
19th May 2017, 3:39 PM
Subham Chakrabertty
Subham Chakrabertty - avatar
+ 1
while(x<=100) { cout<<"mazen"; i++; }
23rd May 2017, 8:00 AM
mrwan zeed
mrwan zeed - avatar