+ 6

Hi guys, please help me for creating a c++ code , which output is age & input is date of birth

9th Jul 2017, 4:33 AM
DILKHUSH KUMAR
DILKHUSH KUMAR - avatar
7 Respostas
+ 8
I wants in c++ code
9th Jul 2017, 4:50 AM
DILKHUSH KUMAR
DILKHUSH KUMAR - avatar
+ 7
in c++ lang,
9th Jul 2017, 4:44 AM
DILKHUSH KUMAR
DILKHUSH KUMAR - avatar
+ 2
In what language? And what have you tried?
9th Jul 2017, 4:40 AM
Igor B
Igor B - avatar
+ 2
Here's one possible algorithm: - ask user to input date of birth - extract year of birth from the date - obtain current year - subtract year of birth from current year to obtain the age - compare current month / day of month to that of birth date - if current month / day is earlier, reduce age by 1 - output age
9th Jul 2017, 4:47 AM
Igor B
Igor B - avatar
+ 1
Try to implement the algorithm I outlined. If you get stuck, show your code and describe what doesn't work.
9th Jul 2017, 12:53 PM
Igor B
Igor B - avatar
+ 1
#include <iostream> using name space std; int main () { int birthyear; int currentyear; int age=0; cout<< "enter you birth year :"<<endl; cin>> birthyear; cout << "enter the current year:"<<endl; cin>>currentyear; age=currentyear-birthyear; cout<< "your age is :"<<age<<endl; return 0 /* this prograrm made by mahmood hurmuzlu */ }
10th Jul 2017, 10:57 PM
mahmood
mahmood - avatar
+ 1
@mahmood: the question asks to enter date of birth not year of birth.
11th Jul 2017, 1:02 AM
Igor B
Igor B - avatar