First C++ Programme, Inspection Needed Please?

This is a discussion on First C++ Programme, Inspection Needed Please? within the C++ Programming forums, part of the General Programming Boards category; Don't know if it's coded to the best or not, as its my first attempt using IF's , but by ...

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    1

    First C++ Programme, Inspection Needed Please?

    Don't know if it's coded to the best or not, as its my first attempt using IF's , but by looking at it I'm sure iv'e made more work for my self then i needed to.

    Feedback please, or anyway I could have made this easier if its possible.


    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    
    {
        system("TITLE My First C++ Programme!");
        system("COLOR 04");
        int age; //variables
        int sonsage;
    
        cout << "How Old Are You?";
        cin >> age;
    
        if ( age > 50 )
    
        {
            cout << "your getting old :(!\n";
            cout << "How old is your son?";
        cin >> sonsage;
    
        }
    
        else if ( age < 50 )
    
        {
    
        cout << "Your young :) :)\n";
    
        cout << "How old is your son?";
        cin >> sonsage;
        }
    
    
        if ( sonsage < 10 )
    
        {
            cout << "Wow hes a young man he is!\n";
    
        }
    
        else
    
        {
            cout << "i dont care!!! hahahahahahahahah :)\n";
        }
    }
    Thank you

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,758
    Not a whole lot to say, but if you're always going to ask about the son, the input statements do not need to be in an if-else block.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Those messages are scary...
    If you only care about kids when they're under 10, there's something really wrong with you.

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,655
    You are ... as a contraction ... is YOU'RE not YOUR! Argh!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help me with ma c programme..
    By eddie19 in forum C Programming
    Replies: 19
    Last Post: 08-12-2009, 08:53 AM
  2. Closing a programme with cin.get
    By Dontgiveup in forum C++ Programming
    Replies: 2
    Last Post: 03-14-2009, 03:35 PM
  3. How to view the programme before it disappears
    By yousuf in forum C Programming
    Replies: 2
    Last Post: 03-22-2008, 09:12 AM
  4. Replies: 3
    Last Post: 05-13-2007, 09:55 AM
  5. Gui Programme does'nt Compiles from DOS
    By Shadowhunt in forum C++ Programming
    Replies: 1
    Last Post: 06-06-2003, 09:05 AM

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