Visual Study

doran_lum

Senior Member
Joined
Oct 16, 2002
Messages
1,296
Reaction score
2
Hi all, I just started my programming course. I just install Visual Studio and was testing to run a simple C++ code but I don't get the result screen for all codes.

After hitting Ctrl+F5 for the 1st time, it will just show the output lines in the 1st screenshot. The cmd screen seem to pop out for a short time and then disappear.

On the 2nd time hitting the Ctrl+F5 button in the 2nd screenshot it doesn't do anything.

I have restarted by laptop and reinstall Visual Studio 2013 twice.

726807


726808
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Hi all, I just started my programming course. I just install Visual Studio and was testing to run a simple C++ code but I don't get the result screen for all codes.

After hitting Ctrl+F5 for the 1st time, it will just show the output lines in the 1st screenshot. The cmd screen seem to pop out for a short time and then disappear.

On the 2nd time hitting the Ctrl+F5 button in the 2nd screenshot it doesn't do anything.

I have restarted by laptop and reinstall Visual Studio 2013 twice.

726807


726808

add the following codes before "return 0"

Code:
getchar();

If your concern is why the CMD close so fast, that is because Window close the cmd prompt upon program completion.

Put in a getchar() at the end to wait for user response. That will stall the application for you to see the standard output of your program
 

doran_lum

Senior Member
Joined
Oct 16, 2002
Messages
1,296
Reaction score
2
add the following codes before "return 0"

Code:
getchar();

If your concern is why the CMD close so fast, that is because Window close the cmd prompt upon program completion.

Put in a getchar() at the end to wait for user response. That will stall the application for you to see the standard output of your program

Thanks this work.. but it was weird that my classmate didn't have to add in this getchar();

They didn't have the same issue as me but we were all practicing the same worksheet..
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Thanks this work.. but it was weird that my classmate didn't have to add in this getchar();

They didn't have the same issue as me but we were all practicing the same worksheet..

http://stackoverflow.com/questions/1775865/preventing-console-window-from-closing-on-visual-studio-c-c-console-applicatio
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top