I'am using visual studio as IDE when i run the program the black screen shutdown automatically !!! anyone know the problem ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'am using visual studio as IDE when i run the program the black screen shutdown automatically !!! anyone know the problem ?

27th Jun 2016, 7:06 PM
Ahmed Said
Ahmed Said - avatar
18 Answers
+ 2
make sure you add conio.h to use _getch () .....
28th Jun 2016, 6:15 AM
Mukul Kumar
Mukul Kumar - avatar
+ 1
in older version getch(); and new version _getch();
27th Jun 2016, 7:19 PM
diako
diako - avatar
+ 1
Thank you mukul it's working now 👍
28th Jun 2016, 9:26 AM
Ahmed Said
Ahmed Said - avatar
+ 1
using the Ctrl+F5(run without debug) not the F5(run with debug) if you do not debug your code
18th Jul 2016, 7:28 PM
S1xe
S1xe - avatar
0
u must type _getch(); before return 0;
27th Jun 2016, 7:09 PM
diako
diako - avatar
0
cout << "Hello World!" << endl; getch (); return 0; like this 👆
27th Jun 2016, 7:13 PM
Ahmed Said
Ahmed Said - avatar
0
yes but u forgot this _
27th Jun 2016, 7:15 PM
diako
diako - avatar
0
_getch();
27th Jun 2016, 7:15 PM
diako
diako - avatar
0
I think you mean cin.get() 'cause i do it like this and it work know Thank you :)
27th Jun 2016, 7:16 PM
Ahmed Said
Ahmed Said - avatar
0
your program has no reason to pause. you need to add one, basically get it to ask for input.
27th Jun 2016, 7:16 PM
Markulees
0
ur welcome
27th Jun 2016, 7:17 PM
diako
diako - avatar
0
it didn't work when i wrote it _getch ();
27th Jun 2016, 7:18 PM
Ahmed Said
Ahmed Said - avatar
0
what is ur vs version?
27th Jun 2016, 7:18 PM
diako
diako - avatar
0
2012
27th Jun 2016, 7:22 PM
Ahmed Said
Ahmed Said - avatar
0
you can also use system ("pause") if you're only working with the program on windows
27th Jun 2016, 11:17 PM
destro
0
You may try these steps to avoid that problem: Go to project properties << config properties << linker << system << click subsystem << choose console << apply << ok
28th Jun 2016, 5:13 PM
Eric Daniel
0
i didn't find linker ?!
28th Jun 2016, 5:43 PM
Ahmed Said
Ahmed Said - avatar
0
getch work to hold the screen
29th Jun 2016, 12:25 AM
pankaj kirola
pankaj kirola - avatar