Possible Duplicate:
Visual Studio Console App - Prevent window from closing.
I'm starting to learn C++ on Windows and I'm trying a few different development environments:1. Netbeans with Cygwin compiler2. MS Visual Studio 2010
Minimum: Intel Pentium 4 or AMD Athlon 64. A CPU that has SSE2 support is required. Activation key for etabs 2015. Recommended: Intel Core 2 Duo, AMD Athlon 64 X2, or better. System RequirementsProcessor.
The great thing is they will never retreat and let out a final powerful blow when they finally fall!3. You don’t want your slayers fighting trash units, not that they won’t win, just you want to get the most out of the gold you spent on this unit. They have plenty of damage, albeit low defense. Warhammer total war 2 dwarves. However, if used correctly they can turn the tide of a battle easily, as their bonuses allow them to take down large monsters with ease.
For either of them, when I write a very simple Hello World program, I build it and it's fine. But when I try to run the program, the command prompt window pops up really quick and then disappears right away.
This happens whether it's in Debug or Release config. Please help with this - I can't see my program output! :(
Windows 10 Command Prompt Appears Then Disappears 10
Thanks.
Start Windows From Command Prompt
EDIT1:Thanks for the replies. This is my code:
I tried Ctrl+F5 for 'Start without Debugging' and that doesn't work. It still flashes the black console screen then disappears right away.
I also tried adding in std::cin.get(); and this works with Ctrl+F5, but isn't that a really.. inelegant workaround solution? I'd rather have my program in the final form.
The breakpoint works, but then I have to run with debugging and the console window flashes and disappears, but then it stays in the background. Any way to get the console to stay in the foreground so I can see program output right away? Seems like that's how it should work.
Any more ideas? Why wouldn't Ctrl+F5 work?
Community♦
John SmithJohn Smith
marked as duplicate by sbi, Steve Townsend, user54262, Johannes Schaub - litb, fredoverflowNov 14 '10 at 21:56
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
6 Answers
After you are done with your program, press user225312user225312
Ctrl + F5 ( Run without debugging ). This will prompt before closing the window and this is what you want.
68k5959 gold badges148148 silver badges174174 bronze badges
Simone
9,81611 gold badge2222 silver badges3737 bronze badges
I think your program just prints
Hello World and then exits. That's the reason the console closes immediately. You can run the executable from Command Prompt (Start Menu > Run and type cmd.exe).Otherwise, you can put std::cin.get() in your code so that program waits for user's input and hence the console window remains open until a key is pressed.
swatkatswatkat
use Mohamad AlhamoudMohamad Alhamoud
Ctrl+F5 to run your program or set a break point in the last line or write cin>> to any vraiable at the end..etc
3,16388 gold badges2727 silver badges4141 bronze badges
Your application is probably working. Make the last command in your console application wait for user input: e.g int i;
string i;cout<<'Hello';cin<<i;
TheCeeTheCee
Issue a soulseekahsoulseekah
getchar() before returning or run from cmd.exe
6,51733 gold badges3939 silver badges5151 bronze badges
Not the answer you're looking for? Browse other questions tagged c++windowsvisual-studionetbeanscygwin or ask your own question.Windows 10 Command Prompt Appears And Disappears
Hello everyone. As the title says, for about a week I believe I see the command prompt box pop up for half a second then suddenly disappear. This hasn't been happening often as far as I can tell, but unfortunately I use my computer more for YT videos, and music for background noise than anything else, so i'm not usually looking at the screen when the computer is on. I have ran Avast antivirus full scan, Avast boot-time scan, Malwarebytes, JRT (Junkware Removal Tool), Adwcleaner, and I have checked task manager as soon a I think I see it open, to see if I can spot something amiss. Everything has come up clean, I have not been to any shady sites, nor have I downloaded any programs. If anyone could help or confirm for a certainty that this isn't a malware issue I would be grateful. Thank you.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |