Loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Loop

What loop code should I use to have the following simple calculator to run after an operation without the window closing and having to rerun to perform another operation? https://code.sololearn.com/cnK46c0mQjj5/?ref=app

26th May 2018, 10:45 AM
SMILE
2 Answers
+ 1
Put it inside a while (true) { … } loop
26th May 2018, 1:05 PM
TurtleShell
TurtleShell - avatar
+ 1
Put all your program inside a while(True){}. For break, put a if statement get some key like k to be press. For example: cin >> keyForBreak; if (keyForBreak == ‘a’) break;
27th May 2018, 5:44 PM
Sarah