Answer to Question #264159 in C++ for fiona

Question #264159

Using while or do-while loop. Make a program that will input birth year. Compute and Display the age of this current year 2021. Your will be terminated if you input zero in the birth year. 


1
Expert's answer
2021-11-10T16:49:25-0500
#include<iostream>
using namespace std;
int main(){
	int birth_year;
	do{
		cout<<"Enter birth year:\n";
		cin>>birth_year;
		cout<<"The age is "<<2021- birth_year<<endl;
	}while(birth_year !=0);
	cout<<"Terminated successfully";
}

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