Hello.

New? Tell us about yourself. Get to know your fellow members.

Hello.

Postby Terrysan on Thu Feb 22, 2007 8:57 am

Hey, guys!

I got this website from a friend of mines a while back. I'm new to programming so I've come here to seek knowledge from this community. I look forward to learning whatever you guys can teach me. C++ is something I've always wanted to learn.

Maybe someone can tell me if I wrote this correctly.

Code: Select all
#include <iostream>
using namespace std;

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


After I compiled and ran it. Is the program supposed to stay open? Because when I try to run HelloWorld.exe, the program just flashes on my screen and then disappears. I have no idea if I did it right or not.

Anyone have an answer for me? Thanks! Smile
Terrysan
Newbie
Newbie
 
Posts: 2
Joined: Thu Feb 22, 2007 8:49 am
Location: California, USA

Re: Hello.

Postby Rommaster on Thu Feb 22, 2007 10:18 am

The source you have doesn't include any errors or warnings since i've compiled it myself.

After I compiled and ran it. Is the program supposed to stay open? Because when I try to run HelloWorld.exe, the program just flashes on my screen and then disappears. I have no idea if I did it right or not.

The flashing thing is normal. It just executes the program and then closes the ms-dos console. If you go to start, run, cmd ; the window shouldn't disappear after you ran the program.

Code: Select all
C:\Documents and Settings\***\Bureaublad>helloworld
Hello World!
C:\Documents and Settings\***\Bureaublad>


Bureaublad = Desktop
SwiftIRC - irc.swiftirc.net - #phoenix
Phoenix-Network

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
Rommaster
Phoenix Veteran
Phoenix Veteran
 
Posts: 960
Joined: Thu Mar 10, 2005 1:05 pm
Location: The Netherlands

Re: Hello.

Postby Samppa on Thu Feb 22, 2007 10:30 am

Alternatively add cin.get(); between the cout and return 0 lines to make the program wait for you to press Enter before closing.

And welcome Very Happy
(\__/)
(='.'=) This is RomMaster's Bunny. Copy and paste bunny into your
(" )_(" ) signature to help him gain world domination.
Samppa
Phoenix Veteran
Phoenix Veteran
 
Posts: 744
Joined: Thu Feb 02, 2006 10:00 am
Location: Finland

Re: Hello.

Postby crack0 on Thu Feb 22, 2007 7:23 pm

welcome Terrysan, see you in programing thread Wink
Remember happiness can be found even in the darkest of times who only remembers to turn on the light
crack0
Regular
Regular
 
Posts: 111
Joined: Sun Dec 18, 2005 7:48 pm
Location: serbia


Return to Introduce Yourself

Who is online

Users browsing this forum: No registered users and 1 guest

cron