#1
I'm a bored computer noob.

Here's what I entered
// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}



I have no idea what should happen. I was expecting something to pop up saying hello world, but after I debugged it, nothing happened. What do I need to do?
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.
#2
take it to the computer thread
Belief is a beautiful armour but makes for the heaviest sword.
#3
Well i don't know about your '10 version, but works fine in my 2008

Try using this:


// my first program in C++  
#include <iostream> 
using namespace std;  
void main () 
{ 
cout << "Hello World!";

} 


or

// my first program in C++

#include <stdio.h>

void main ()
{
printf("Hello world");
} 
Last edited by szekelymihai at Jun 22, 2010,
#4
What does yours DO after debugging it? Is there something wrong with mine that makes it not do anything? There are no bugs in it..
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.
#5
It'll write Hello World in the console, then instantly exit. Either set a breakpoint on the "return 0", or use scanf / cin to wait for input as a form of pausing, since you're not running it from a console.
#6
Oh, a black screen pops up for a nanosecond. I don't think it says hello world though..even when I do insert a breakpoint or scanf / cin
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.
#7
Quote by Kapps
It'll write Hello World in the console, then instantly exit. Either set a breakpoint on the "return 0", or use scanf / cin to wait for input as a form of pausing, since you're not running it from a console.

Good idea. You can do it this way also.


// my first program in C++

#include <iostream>
using namespace std;
#include <conio.h>

int main ()
{
cout << "Hello World!";
return 0;
getch();
} 


Now it will wait until you press a (any) key , then exit.
#8
This is the output now..

'hello.exe': Loaded 'C:\Users\MyPC\Documents\Visual Studio 2010\Projects\hello\Debug\hello.exe', Symbols loaded.
'hello.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'hello.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'hello.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'hello.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[5124] hello.exe: Native' has exited with code 0 (0x0).
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.
#9
Your program is probably fine. It should just print Hello World to the output window. I haven't used Visual Studio 2010 so I don't say where this would be.
#10
I only have the express version..the free one.

Is there a different compiler for free you'd recommend? I'm obviously a very beginner at programming, but I want to learn a bit this summer.
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.
#11
The output in that output window is irrelevant. Look at what it writes in the console. Just make sure you set the breakpoint or cin AFTER the printf/cout.
#12
I apologize for my ignorance, but I have no idea what the console window looks like. Was it this frustrating for others beginning programming? I'm not having difficulty with the language writing so far, but just using the program..
I'm not a Bible-thumper anymore. Realized I had a brain in '09.

I like guitars, running, and math.