How can you stop the program when you need to? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you stop the program when you need to?

I'm coding a calculator and I need to stop the program until the user press a key

5th Jul 2016, 9:41 PM
ARPIKIHS
ARPIKIHS - avatar
2 Answers
+ 1
what IDE are you using... if its visual studio then include conio.h and use this function like this char a; ... a=_getch (); ... this function 'pauses' the program and take the char value as you press a key. use getch () instead if you use other IDEs.
6th Jul 2016, 2:09 AM
Mukul Kumar
Mukul Kumar - avatar
0
you can use a switch statement for the users input and if a certain key is entered or pressed call for the application to exit
5th Jul 2016, 11:24 PM
destro