C语言1900/1/1日期推算
#include <stdio.h>
#include <stdlib.h>
void yrCalc(long int,int*,int*,int*);
int main(int argc, char *argv[]) {
long int number;
int year,month,day;
//inpput
printf("Pleaese input the total numbers of days from the date 1/1/1900\n");
scanf("%d",&number);
//call the function
yrCalc(number,&year,&month,&day);
//output
printf("%d/%d/%d\n",year,month,day);
system("pause");
return 0;
}
void yrCalc(long int number,int*year,int*month,int*day){
*year=1900+number/360;
*month=1+(number-(number/360)*360)/30;
*day=1+(number-(number/360)*360-((number-(number/360)*360)/30)*30);
}
(按照每月30天每年360天计算)