Have a question here, I am working on a program that will calculate how old a person is using years, days and months.
How would I calculate how many days old someone is from their birthday to the present day? Same with months? I got the years easy
***EDIT*** Doh dont need the #include string..
Here is what I got so far:
Code:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int yob=0;
int dow=0;
int mob=0;
int result=0;
int currentyear=2003;
int currentday=16;
int x=0;
cout<<"Enter your Year of birth: ";'\n';
cin>>yob;
result= yob - currentyear;
cout<<"You are"<<result<<"years old"<<'\n';
cout<<"Enter you Day of Birth: ";'\n';
cin>>dow;
while(dow != 365){
x=dow+365;
result = dow - currentday;
cout<<"You are"<<result<<"days old"<<'\n';
return 0;
}
Anyone help?