"C:\age calculator\age calculatorr.cpp(68) : error C2447: missing function header (old-style formal list?)" tried to find the error...but was unable!!!
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int monthb,dateb,yearb;
cout<<"Jnab plz enter ur date of birth="<<endl;
cin>>dateb;
cin>>monthb;
cin>>yearb;
if((dateb>0 && dateb<32) && ((monthb==1)||(monthb==3)||(monthb==5)||(monthb==7)||(monthb==8)||(monthb==10)||(monthb==12)))
{
cout<<"corect date of birth="<<dateb<<"-"<<monthb<<"-"<<yearb<<endl;
}
else if(dateb<31 && monthb==9||monthb==11||monthb==4||monthb==6)
{
cout<<"correct date of birth="<<dateb<<"-"<<monthb<<"-"<<yearb<<endl;
}
else if(dateb<30 && monthb==2 && yearb%4==0)
{
cout<<"correct date of birth="<<dateb<<"-"<<monthb<<"-"<<yearb<<endl;
}
else if(dateb<29 && monthb==2 && yearb%4!=0)
{
cout<<"correct date of birth="<<dateb<<"-"<<monthb<<"-"<<yearb<<endl;
}
else
{
cout<<"wrong date of birth"<<endl;
}
{
int monthd,dated,yeard;
cout<<endl;
cout<<"Jnab plz enter date of death="<<endl;
cin>>dated;
cin>>monthd;
cin>>yeard;
if((dated>0 && dated<32) && (monthd==1||monthd==3||monthd==5||monthd==7||monthd==8||monthd==10||monthd==12))
{
cout<<"corect date of death="<<dated<<"-"<<monthd<<"-"<<yeard<<endl;
}
else if(dated<31 && monthd==9||monthd==11||monthd==4||monthd==6)
{
cout<<"correct date of death="<<dated<<"-"<<monthd<<"-"<<yeard<<endl;
}
else if(dated<30 && monthd==2 && yeard%4==0)
{
cout<<"correct date of death="<<dated<<"-"<<monthd<<"-"<<yeard<<endl;
}
else if(dated<29 && monthd==2 && yeard%4!=0)
{
cout<<"correct date of death="<<dated<<"-"<<monthd<<"-"<<yeard<<endl;
}
else
{
cout<<"wrong date of death"<<endl;
}
}
}
{
int dateb,monthb,yearb;
int dated,monthd,yeard;
cout<<"Enter date of Birth"<<endl;
cin>>dateb;
cin>>monthb;
cin>>yearb;
cout<<"enter date of death"<<endl;
cin>>dated;
cin>>monthd;
cin>>yeard;
d=dayd-dayb;
m=monthd-monthd;
y=yeard-yearb;
if((d>0 && d<32) && (monthd==1||monthd==3||monthd==5||monthd==7||monthd==8||monthd==10||monthd==12))
{
d+=31
m-=1
}
else if(d<31 && month==9||month==11||monthd==4||monthd==6)
{
d+=30
m-=1
}
else if(d<30 && monthd==2 && yeard%4==0)
{
d+=29
m-=1
}
else if(d<29 && monthd==2 && yeard%4!=0)
{
m+=12
y-=1
Another note:
Lose the habit of using void main(), every time you use it, I die a little.
(Use int main() instead, because void main() is only supported by some Microsoft compilers.)
Off-topic:
My keyboard just died a little, too. The M-key jumped off while typing this.