Answer to Question #266066 in C++ for Faiqa gul

Question #266066

Write a program which takes your age as an input and output of your program should b like this


You are 24 years old


One year ago,you were 23


In one year you will be 25

1
Expert's answer
2021-11-15T00:20:25-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


#include<iostream>


#include<conio.h>


using namespace std;


int main()


{
  
 //prompt the user to enter his/her age
 int age;
 cout<<"\nEnter your age: ";
 cin>>age;
 
 cout<<"\nYou are "<<age<<" years old"<<endl;
 
 cout<<"\nOne year ago, you were "<<(age-1)<<endl;
 
 cout<<"\nIn One year  you will be "<<(age+1)<<endl;


  return 0;


}


SAMPLE PROGRAM OUTPUT






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