报错 ld returned 1 exit status
源代码如下:#include <stdio.h>
#include<algorithm>
#include <iostream>
using namespace std;
struct date{
int year;
int month;
int day;
}x[100];
bool operator<(const date& a,const date& b){
if(a.year==b.year){
if(a.month==b.month)
return a.day<b.day;
return a.month<b.month;
}
return a.year<b.year;
}
int md[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool judge(date a){
if(a.year<1960||a.year>2059)
return false;
if(a.month<=0||a.month>12)
return false;
if(a.year%4==0){
if(a.month==2){
return a.day>=1&&a.day<=29;
}
return a.day>=1&&a.day<=md[a.month];
}
else return a.day>=1&&a.day<=md[a.month];
}
int cnt=0;
void myscanf(int a,int b,int c){
date d;
d.year=a;
d.month=b;
d.day=c;
if(judge(d))
x[cnt++]=d;
}
int mian(){
int a,b,c;
scanf("%d/%d/%d",&a,&b,&c);
//年月日
myscanf(1900+a,b,c);
myscanf(2000+a,b,c);
//月日年
myscanf(1900+c,a,b);
myscanf(2000+c,a,b);
//日月年
myscanf(1900+c,b,a);
myscanf(2000+c,b,a);
sort(x,x+cnt);
for(int i=0;i<cnt;i++){
if(x[i].year!=x[i-1].year||x[i].month!=x[i-1].month||x[i].day!=x[i-1].day)
printf("%d-%02d-%02d\n",x[i].year,x[i].month,x[i].day);
}
return 0;
}