Friday, July 31, 2009

C++ beginner problem!?

hey everyone, im starting out C++ programming using Visual c++ 2008.


I have done the whole hello world file. The problem is when i press start debugging (i.e. play) the prompt comes up for like less than second! Its weird, they said the prompt should come up in the tutorial but i never get a chance to see anything?


Any help?


Appreciate it:)

C++ beginner problem!?
Either set a breakpoint on the last line of your main() function, or add something like this to the end:





std::string x;


std::cin%26gt;%26gt;x;





That'll pause the program until you type something and press Return.
Reply:that isn't supposed to happen but you can make an infiite loop if you need to keep the prompt there.





like:


boolean foo;


do{


foo = true;


} while (foo == true);
Reply:If you are using Visual C++ (express?) 2008, it should stay up until you "Press any key to continue". Try pressing Ctrl + F5 instead. It runs AND compiles it. If that doesnt work, try adding system("pause"); after your cout%26lt;%26lt;"hello world"; statement.
Reply:Attempting to read anything from stdin should keep your dialog up.


No comments:

Post a Comment