This is a program to find age of a person .C++ is showing me an "expected" error in line 33. Error is present function definition of calculate(). Can you please help me fix it. I can't understand what is the error.
#include<iostream.h>
#include<conio.h>
struct date
{
int day;
int month;
int year;
};
date birth;
date current;
void main()
{
void calculate(int,int,int,int,int,int);
cout<<"\nEnter your date of birth";
cout<<"\nDay: ";
cin>>birth.day;
cout<<"\nMonth: ";
cin>>birth.month;
cout<<"\nYear: ";
cin>>birth.year;
cout<<"\nEnter current date";
cout<<"\nDay: ";
cin>>current.day;
cout<<"\nMonth: ";
cin>>current.month;
cout<<"\nYear: ";
cin>>current.year;
calculate (birth.day,birth.month,birth.year,current.day,current.month,current.year);
getch();
}
// Error on line below
void calculate(int birth.day,int birth.month,int birth.year,int current.day,int current.month,int current.year)
{
int monthdays[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(birth.day>current.day)
{
current.day=current.day=monthdays[birth.month-1];
current.month=current.month-1;
}
else if(birth.month>current.month)
{
current.year=current.year-1;
current.month=current.month+12;
}
int calculated_date=current.date-birth.date;
int calculated_month=current.month-birth.month;
int calculated_year=current.year=birth.year;
cout<<"Present age= "<<calculated_date<<calculated_month<<calculated_year;
}
There is error in (33,27)