A simple question

This is a discussion on A simple question within the C++ Programming forums, part of the General Programming Boards category; hello I'm new to C++, and I've looked at some of the examples found on the cprogrammings tutorials. I have ...

  1. #1
    Hansteen
    Guest

    A simple question

    hello
    I'm new to C++, and I've looked at some of the examples found on the cprogrammings tutorials. I have no problem understanding what they do(and have no problems with the codes in itself), but after i compiled it, i dont reach reading the last answer/message I get, cause it dissapear really fast. Do anyone know how to make the last messages, replies, last for a while so it is possible to read it?
    Answer would be appreciated
    Thanks
    Hansteen

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Have the program wait for user input at the end of the program, that way it won't close until the user types something.
    Code:
    #include <cstdio>
    
    int main ( void )
    {
      // Do stuff
      getchar();
      return 0;
    }
    -Prelude
    My best code is written with the delete key.

  3. #3
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Well I guess this is the easiest way I can think of.......

    Code:
    #include <iostream.h>
    
    int main()
    {
    
    cout<<"Type a letter and the press Enter to exit"<<endl;
    int exit;
    cin>>exit;//this will pause until something is typed.
    
    return 0;
    }
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 09:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-21-2005, 12:41 AM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 06:58 PM

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