0

How to make your program ask you if you want to exit

For my 1st program, I have created a small calculator which gives you the addition the multiply and the abstraction of 2 numbers.But the program terminates instantly when it does and sows the math and the user isn't able to see the result.Can anyone tell me how can I add a function to the program that will ask you if you want to exit ?

17th May 2019, 10:12 AM
DRIMITEROS
DRIMITEROS - avatar
3 Réponses
+ 5
I like to use a Boolean (i.e bool quit = false) (while(!quit) {}) which is essentially exactly what Anna is proposing 😀
17th May 2019, 10:35 AM
jay
jay - avatar
+ 4
Put the whole code in an infinite loop (while(true) {}) that is only interrupted when the user enters something like "quit"
17th May 2019, 10:26 AM
Anna
Anna - avatar
+ 3
Thank you very much.I did it
17th May 2019, 10:47 AM
DRIMITEROS
DRIMITEROS - avatar