hello!
i would like to ask something about a program that i am trying to do. I wrote the program but i cant find where is my fault and doesnt check the right day for the february. I sent you my program, if anybody has something to suggest. The suggestion of the exercise doesnt recomment leap loop just only the m[]
. Thank you in advance ......mp
#include <iostream>
using namespace std;
int get_date(int day,int month,int year);
void main(){
int day,year,month;
cout<<"day: ";
cin>>day;
cout<<"month: ";
cin>>month;
cout<<"year: ";
cin>>year;
get_date(day,month,year);
}
int get_date (int day,int month,int year){
int m[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if ((day>0 && day<31) && (month>0 && month<=12) && year>0)
{
if((year%4)==0) m[1]=29;
if (day<=m[month-1])
{
cout<<"H imerominia einai: "<<day<<"-"<<month<<"-"<<year;
else
cout<<"wrong";
cout<<endl;
}
else
cout<<"wrong";
}
return 0;
]