Answer to Question #324039 in C++ for ness

Question #324039

One day while Cody was playing with his friends in the woods, they stumbled upon a bearded old man living alone in his cabin. Cody and his friends were shocked that somebody could grow that old. Cody, refusing to believe that it is possible, asked the old man his age. The old man said, "My age is the sum of The Programmer and your teacher's ages subtracted by the age of your friend, Peter". Puzzled with this statement, Cody quickly tried to input the ages of The Programmer, his teacher, and his friend, Peter. Help Cody find out the age of the old man.


1
Expert's answer
2022-04-06T13:55:26-0400
#include <iostream>

using namespace std;

int main()
{
	int progAge, teachAge, PetAge;
	cout << "Please, enter The Programmer`s age: ";
	cin >> progAge;
	cout << "Please, enter teacher's age: ";
	cin >> teachAge;
	cout << "Please, enter Peter's age: ";
	cin >> PetAge;
	cout << "The age of the old man is " << PetAge - (progAge + teachAge);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS