Question: Write a C++ program that asks the user to enter their age. If the age is 18 or above, print a message indicating that

Write a C++ program that asks the user to enter their age.  

Write a C++ program that asks the user to enter their age. If the age is 18 or above, print a message indicating that the user is an adult. If it is below 18, ask for the name of their adult companion, and print a message with the adult companion name. If the age is above 100 or below 0, print an "Invalid age" message. Example program output: Enter your age: 15 You are a minor. Please enter the name of your adult companion: Ahmad Your adult companion is: Ahmad #include using namespace std; int main() {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!