Just getting started...Hello world???

This is a discussion on Just getting started...Hello world??? within the C++ Programming forums, part of the General Programming Boards category; OK......Well, I'm just trying to get on this C++ stuff. I bought a book and I'm trying to get the ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    2

    Smile Just getting started...Hello world???

    OK......Well, I'm just trying to get on this C++ stuff. I bought a book and I'm trying to get the "hello world" program to work. I typed it in the new source code just like the book had, saved it as a .ccp, complied and ran it using Bloodshed.....but all that it does is flash a little black screen for like a half second on my screen. I had the idea that I was supposed to see the words "hello world" on my screen. Am I messing up the code or do I just not know what I'm looking for? Any replies would be appreciated!! Thanks!

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    http://www.cprogramming.com/boardfaq.html#pause go with option 1, put it right before the return 0; line

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    317
    The prog is running, it just terminates really fast. To give you time to see include:
    Code:
    cin.get();
    immediately prior to return 0 statement

  4. #4
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    Once again, can we get a count how many times we've seen this here? Someone should sticky something on how to do this. No, you did nothing wrong, if you did something wrong you would probably get errors. The reason it flashes is because:
    The program is over.

    your program probably looks like this
    Code:
    #include <iostream.h>
    
    int main()
    { 
        cout<<"Hello world";
        return 0;
    }
    try adding this:
    Code:
    cin.get();
    before return 0; and after cout<<"Hello world";

  5. #5
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    Originally posted by XSquared
    http://www.cprogramming.com/boardfaq.html#pause go with option 1, put it right before the return 0; line
    Option 3:
    Code:
    #include <iostream.h>
    #include <stdlib.h>
    
    int main()
    {
       cout<<"Hello world"<<endl;
       system("PAUSE");
       return 0;
    }

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    2

    Thanks!

    Thanks everyone. I've had this book since February and thought I was a failure because I couldn't get the first lesson to work. I'm glad I decided to dive back into it today. Thanks again!

  7. #7
    Unregistered
    Guest
    HI!
    You could also try using

    Code:
    getch();
    It waits for the user to press a key before continuing forward. I use it all the time!

  8. #8
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    wut header do gletch use?

    jenn321 do you have aim, if so aim klinerr1 im always on
    Last edited by Klinerr1; 07-06-2002 at 08:30 PM.
    Email: Klinerr1@nc.rr.com || AIM: MisterSako || MSN: sakotheinsane@hotmail.com

    -the shroom has spoken

  9. #9
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    getch() is in conio.h

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get started with writing driver in Linux?
    By Maz in forum C Programming
    Replies: 1
    Last Post: 04-21-2009, 09:10 AM
  2. Help getting started..matrices
    By BobDole11 in forum C Programming
    Replies: 7
    Last Post: 11-15-2008, 08:51 PM
  3. Change the world
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 51
    Last Post: 11-22-2001, 03:23 PM
  4. No More Technology After World War Three
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-20-2001, 07:02 PM
  5. Need help getting started
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2001, 11:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21