Thread: Hello World won't work.

  1. #31
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    Code:
    #include <iostream>
    #include <conio.h>
    
    using namespace std;
    
    int main()
    {
         cout << "Hello World\n\n";
         cout << "Press a ENTER to continue...";
         getch();
         return 0;
    }

  2. #32
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    There are many different ways of pausing the program so that the console stays open. Use whatever works for you and makes you happy, but be aware that solutions like system("pause") and getch() won't work for some other people, so when you post your code for help, some people won't take the time to change your code so that it will compile and work on their machines.

    If you use cin.get(), it will compile and run on everybody's machines, but there are situations where it doesn't work by itself and requires an extra cin.ignore() before it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Developers Wanted
    By Quasicom in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 08-24-2005, 12:46 AM
  2. Novice Beginner: Simple hello world wont work
    By hern in forum C++ Programming
    Replies: 8
    Last Post: 06-25-2005, 12:16 PM
  3. OpenGL coordinates
    By Da-Nuka in forum Game Programming
    Replies: 5
    Last Post: 01-10-2005, 11:26 AM
  4. Too much to ask ?
    By deflamol in forum C Programming
    Replies: 2
    Last Post: 05-06-2004, 04:30 PM