7. An Old Man's Age 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. Input 1. Age of The Programmer 2. Age of his teacher 3. Age of his friend, Peter Output The first line will contain a message prompt to input the age of The Programmer. The second line will contain a message prompt to input the age of his teacher. The third line will contain a message prompt to input the age of his friend, Peter. The last line will contain the age of the old man. Enter age of The Programmer: 21 Enter age-of his teacher: 52 Enter age of his friend, Peter: 10 The age of the old man is 63

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question
Please help me fidn the right code in C++. Thank you!
7. An Old Man's Age
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.
Input
1. Age of The Programmer
2. Age of his teacher
3. Age of his friend, Peter
Output
The first line will contain a message prompt to input the age of
The Programmer.
The second line will contain a message prompt to input the
age of his teacher.
The third line will contain a message prompt to input the age
of his friend, Peter.
The last line will contain the age of the old man.
Enter age of The Programmer: 21
Enter age of his teacher: 52
Enter age of his friend, Peter: 10
The age of the old man is-63
Transcribed Image Text:7. An Old Man's Age 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. Input 1. Age of The Programmer 2. Age of his teacher 3. Age of his friend, Peter Output The first line will contain a message prompt to input the age of The Programmer. The second line will contain a message prompt to input the age of his teacher. The third line will contain a message prompt to input the age of his friend, Peter. The last line will contain the age of the old man. Enter age of The Programmer: 21 Enter age of his teacher: 52 Enter age of his friend, Peter: 10 The age of the old man is-63
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr