Why the output does nt remain on the screen when using int main(); nd return 0; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the output does nt remain on the screen when using int main(); nd return 0;

12th Jun 2017, 2:13 PM
Ramya Bali
Ramya Bali - avatar
3 Answers
+ 3
add cin.get(); before return 0; or system("pause");
12th Jun 2017, 2:16 PM
Bagus Prakoso
Bagus Prakoso - avatar
+ 1
thanks
12th Jun 2017, 2:18 PM
Ramya Bali
Ramya Bali - avatar
+ 1
you can use the getch() function by including the conio.h library. and you should use getch just before the return 0 statement. i think now it will work. and if you are using Turbo c++ then it will definietly work. the getch() function is used for holding the output.
12th Jun 2017, 4:54 PM
Paavan Gupta
Paavan Gupta - avatar