-
Nov 15th, 2012, 03:47 PM
#1
[RESOLVED] Output isn't showing
I'm trying desperately to learn C++, with that being said... When I debug:
c++ Code:
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
a window pops up and disappears and in my build menu this comes up:
Loaded 'C:\Documents and Settings\PC #6\My Documents\Visual Studio 2010\Projects\unique\Debug\unique.exe', Symbols loaded.
Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Cannot find or open the PDB file
Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Cannot find or open the PDB file
The program '[1912] unique.exe: Native' has exited with code 0 (0x0).
Why isn't hello world being printed on a command prompt?
Last edited by dday9; Nov 15th, 2012 at 04:07 PM.
-
Nov 16th, 2012, 04:53 AM
#2
Re: Output isn't showing
That is the debug output.
You are writing to the standard output, which in this case is the console windows output. You're just not seeing it because the window closes so fast.
You can always read from stdin at the end of your main method to force the application so stay alive until the user presses enter.
Code:
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
getchar();
return 0;
}
-
Nov 16th, 2012, 10:20 AM
#3
Re: Output isn't showing
Ah ok, sorta like Console.ReadLine()
Thank you Atheist!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|