Thread: whats wrong here

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    26

    whats wrong here

    Code:
    #include <iostream.h>
    #include <stdlib.h>
    
    int main()
    
    {
    
    	int age;
    
    	cout<<"Please enter your age: ";
    
    	cin>>age;
    
    	if(age<=50)
    	{
    		
    	cout<<"Your not that old"; <<endl;
    
    	}
    	else if(age>51)
    	
    	{
    		cout<<"Man your old"; <<endl;
    	}
    
    	return 0; system("pause");
    
    }
    i get an error for the "endl" part of the code. whats wrong??
    Last edited by CobraCC; 04-19-2003 at 01:17 AM.

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Look at your second and third cout statements. You have 1 too many semi-colons in both of them.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    On a side note, your "pause" is after your return statement, so it does nothing.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    26
    thx for the help guys, i took out the extra semi-colons and put the system pause after each respond when you enter your age. now it works fine. thank you

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072

    Re: whats wrong here

    Originally posted by CobraCC

    cout<<"Your not that old"; <<endl;
    cout<<"Man your old"; <<endl;
    cout << "You're not that old." << endl;
    cout << "Man you're old." << endl;
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    26

    Re: Re: whats wrong here

    Originally posted by Sang-drax
    cout << "You're not that old." << endl;
    cout << "Man you're old." << endl;
    my bad

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM