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 ?
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 😀
+ 4
Put the whole code in an infinite loop (while(true) {}) that is only interrupted when the user enters something like "quit"
+ 3
Thank you very much.I did it