All pastes #161456 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-05 13:26 UTC
rendered paste body
#include "iostream"

using namespace std;

int main()
{
        string First ;
        string Last ;
        int Born ;
        int Now ;
        string Year ;
        string Sex ;
        string Married ;
        string Name ;
        int Age ;

        cout << "Your first name : " ;
        cin >> First ;
        First[0] = toupper(First[0]);
        cout << "Your last name : " ;
        cin >> Last ;
        Last[0] = toupper(Last[0]);
        cout << "What year were you born ? (i.e. 1979) : " ;
        cin >> Born ;
        cout << "What year is it now ? (i.e. 2006) : " ;
        cin >> Now ;

        Age = Now - Born ;
        if (Age == 1)
        {
                Year = "year" ;
        }
        else
        {
                Year = "years" ;
        }

        cout << "Your sex [m/f] : " ;
        cin >> Sex ;

        if (Age > 18)
        {
                cout << "Are you currently married ? [y/n] :" ;
                cin >> Married ;
        }
        else
        {
                cout << "I don't suppose you're married." << endl ;
        }

        if (Age < 16)
        {
                Name = "Young. " ;
        }
        else
        {
                if (Sex == "m")
                {
                        Name = "Mr. " ;
                }
                else
                {
                        if (Sex == "f" && Married == "y")
                        {
                                Name = "Mrs. " ;
                        }
                        else
                        {
                                Name = "Ms. " ;
                        }
                }
        }

        cout << "Hello again " <<  Name << " " << Last << "," << endl ;
        cout << First << ", you're " << Age << " " << Year << " old." << endl ;

        return 0;
}