im writing a program that calculates the users age when the current date is entered and the birth date is entered ive been thinking for about 2 hours and i cant figure out how to calculate the age this is what i have so far, im stuck at calcYears cuz im so tired from staying up till 4am last night finishing the WRONG program... sigh :(
#include <iostream>
using namespace std;
void getDate(int&, int&, int&);
void getData(int&, int&, int&);
int calcYears(int, int);
int main()
{
int month, day, year, currentMonth, currentDay, currentYear, years;
getDate(currentMonth, currentDay, currentYear);
getData(month, day, year);
years = calcYears(year, currentYear);
cout << "\t" << years;
//cout << "\t" << month << "\t" << day << "\t" << year << endl;
//cout << "\t" << currentMonth << "\t" << currentDay << "\t" <<currentYear << endl;
system("pause");
return 0;
}
void getData(int& month, int& day, int& year)
{
cout << "\nEnter the month you were born on: ";
cin >> month;
cout << "\nEnter the day you were born: ";
cin >> day;
cout << "\nEnter the year you were born: ";
cin >> year;
cout << endl;
return;
}
void getDate(int& currentMonth, int& currentDay, int& currentYear)
{
cout << "\nEnter the current month: ";
cin >> currentMonth;
cout << "\nEnter the current day: ";
cin >> currentDay;
cout << "\nEnter the current year: ";
cin >> currentYear;
cout << endl;
return;
}
int calcYears(int year, int currentYear, int month, int currentMonth, int day, int currentDay)
{
int years;
years = currentYear - year;
if (month >= currentMonth && days > ...
return years;
}