Hi, it is prog. Ask the user for two user's ages and indicate who is older; behave differently if both are over 100. i cannot write code for
behave differently if both are over 100.
plz help me
#include <iostream>
usingnamespace std;
int main()
{
//declare variables
int ageOne = 0;
int ageTwo = 0;
//enter input items
cout << "Enter age one: ";
cin >> ageOne;
cout << "Enter age two: ";
cin >> ageTwo;
//determine output
if (ageOne > 100 || ageTwo > 100)
{
//display message
if (ageOne > 100 && ageTwo > 100)
cout << "You are both over 100" << endl;
elseif (ageOne > 100)
cout << "Person one is older than 100 and person two is " << ageTwo << endl;
elseif (ageTwo > 100)
cout << "Person two is older than 100 and person one is " << ageOne << endl;
//end if
}
else
{
//display message
if (ageOne > ageTwo)
cout << "Person one is older than person two" << endl;
elseif (ageOne < ageTwo)
cout << "Person one is younger than person two" << endl;
else
cout << "Person one is as old as person two" << endl;
//end if
} //end if
} //end of main function