Advertisement Jump to content
Sign in to follow this  
laurobezerra

[.net] A little problem with a very simple C++ code

This topic is 4378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, Below I have a very simple console app code in C++ written using Microsoft Visual C++ 2005 .NET. When I run this simple program it runs fast and then disappears. I'd like to know what command I have to write in order to make its window on my screen. #include <iostream> #include <stdio.h> using namespace std ; void main() { cout << "How are you??!?!" << endl; }

Share this post


Link to post
Share on other sites
Advertisement
If you put


std::cout << "Press the enter key to exit";
std::cin.ignore(std::cin.rdbuf()->in_avail() + 1);


at the end of the main function it will stay there. ('til you press enter).

(Trick from Beginning C++ game programming)

Share this post


Link to post
Share on other sites
You shouldn't put a pause command in the program itself. You should run it from the editor with Ctrl+F5, or run it from a command prompt.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!