Thread: Dos help.

  1. #1
    Registered User
    Join Date
    Dec 2003

    Dos help.

    #include <iostream.h>			
    int main()				//Most important part of the program!
      int age;				//Need a variable...
      cout<<"Please input your age: ";	//Asks for age
      cin>>age;				//The input is put in age
      if(age<100)				//If the age is less than 100
         cout<<"You are pretty young!";     //Just to show it works
      else if(age==100)		//I use else just to show an example 
         cout<<"You are old";		//Just to show you it works...
        cout<<"You are really old";	//Executed if no other statement is executed
      return 0;
    For some reason, my dos prompt closes after its done with the results, i dont have XP so i cant just right click on the program and go to "program" tab.

    Also someone said to place cint>>whatever ?? Since im new at this, i dunno what he's talking about, i just want the dos screen to stay so i can see results in the .exe

    Also,going to properties in the dos screen doesnt help, i unchecked the thing that said "close when exit" or something, it still closes after it runs. Any help?

    (this is in the tutorials at btw, the second tutorial.)

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2003
    It's supposed to do that, put 'cin>>age;' at the end. Theirs a getches or something where you make a loop 'while(getch!=1);' or something that will wait for user input but I don't know the exact source. Maby someone else does(hint ..hint)

    Edit: I found it: from cpp-home
    Last edited by 1veedo; 12-07-2003 at 08:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File systems?? (Winxp -> DOS)
    By Shadow in forum Tech Board
    Replies: 4
    Last Post: 01-06-2003, 09:08 PM
  2. winver, winminor, winmajor can it be found from dos?
    By ronin in forum A Brief History of
    Replies: 2
    Last Post: 10-02-2002, 10:32 AM
  3. real mode dos & win dos
    By scott27349 in forum A Brief History of
    Replies: 26
    Last Post: 08-19-2002, 06:15 AM
  4. DOS program versus DOS console program
    By scromer in forum A Brief History of
    Replies: 4
    Last Post: 01-10-2002, 01:42 PM
  5. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of
    Replies: 2
    Last Post: 11-08-2001, 07:14 PM