Thread: hello, brand new here, need help with inputting data

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    8

    hello, brand new here, need help with inputting data

    okay, so i have this basic program (from the tutorials section), this is what it is:


    Code:
    #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...
      }
      else
      {
        cout<<"You are really old";	//Executed if no other statement is executed
      }
      return 0;
    }


    anyways, so the problem is, i run the console program and i get prompted :how old are you, so i put in a number and hit enter, then the window just dissappears, this has happened with all my programs that require data inputted.

    any help would be great! thanks

    and BTW, I did do a search, and didn't find anything.
    Last edited by Chrisab508; 10-10-2003 at 10:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inputting Data File Using Pointers
    By jl864405 in forum C Programming
    Replies: 8
    Last Post: 06-04-2009, 05:52 PM
  2. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  3. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 09:53 AM
  4. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  5. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM