Thread: Question with compiling

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    1

    Question with compiling

    I have the Dev-C++ compiler, using windows Vista if that helps. Whenever I try compiling, it will do fine but when the window comes up to show my program, it closes instantly.

    Code:
    #include <iostream>
    
    int main()
    {
     std::cout << "hello\n";
     return 0;
    }
    I just started using C++, and I can't figure out what is wrong. Any ideas?

  2. #2
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Read the FAQ please! Use the search please! For the love of god!
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    The program completed, it did its job and closed. You need to pause it if you wanted it to stay open or await your input to close.

    Code:
    #include <iostream>
    
    int main()
    {
       std::cout << "hello\n";
       cin.get(); //pause program 
    
     return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. Question about linux compiling with GCC
    By elsheepo in forum C++ Programming
    Replies: 23
    Last Post: 03-07-2008, 11:36 PM
  3. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 04:22 AM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  5. Simple Compiling question ...
    By hypertension in forum C++ Programming
    Replies: 2
    Last Post: 02-16-2003, 01:02 PM