Thread: newbie C++ question

  1. #1
    Geo Geo Geo-Fry
    Join Date
    Feb 2003
    Posts
    116

    newbie C++ question

    When I write a program (the one in the tutorial where basicly you type in your age and if it's less than 100 it says your young, if you are 100 it says you are old and if you are older than 100 it says you are very old) and after you type in your age and press enter, you can't see the message, the little DOS window thing just dissapears.

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    7
    im a newb too, but what i usually do, is put another cin>> thing at the end

  3. #3
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Code:
    #include <conio.h>
    
    ....
    
    getch();
    return 0;
    the program will wait for u to hit a key. There are many ways to do this, just search the board.

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    You can configure console applications doing this in their
    properties.

  5. #5
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    Another way..

    Code:
    #include <conio.h>
    
    ...
    
    while(!kbhit());
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    Code:
    #include <iostream>
    
    int main()
    {
        //code
    
        std::cin.get();
        return 0;
    }
    do a search though, and look at the FAQ, they are answered there.

  7. #7
    ! |-| /-\ +3 1337 Yawgmoth's Avatar
    Join Date
    Dec 2002
    Posts
    187
    #include <stdlib.h>

    int main()
    {
    //code
    system("PAUSE");
    }
    L33t sp3@k sux0rz (uZ it t@k3s 10 m1|\|ut3s 2 tr@nzl@te 1 \/\/0rd & th3n j00 h@\/3 2 g3t p@$t d@ m1zpelli|\|gz, @tr0(i0u$ gr@mm@r @|\|d 1n(0/\/\pr3#3|\|$1bl3 $l@|\|g. 1t p\/\/33nz j00!!

    Speling is my faverit sujekt

    I am a signature virus. Add me to your signature so that I may multiply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM