这两段程序有问题吗?
jiami[i].yue=month(p->nian,p->jz,p->number)+1;jiami[i].hao=day(p->nian,p->jz,p->number);
加上去运行就崩溃,
int month(int a,int b,int c)
{
int mon;
struct tm *tmp,*tp;
time_t lt_old,now;
long m,n;
tmp = localtime(<_old); //取得本地时间结构体
tmp->tm_year=2015-1900;
tmp->tm_mon = 1-1; //更改其它部分
tmp->tm_mday= 4;
tmp->tm_hour= 0;
tmp->tm_min = 0;
tmp->tm_sec = 0;
lt_old = mktime(tmp); //返回修改时间的长整形数据
m=b+(a-2015)*52;
m=m*7*24*3600+c*3600*24;
now=lt_old+m;
tp=localtime(&now);
return tp->tm_mon;
}
int day(int a,int b,int c)
{
int mon;
struct tm *tmp,*tp;
time_t lt_old,now;
long m,n;
tmp = localtime(<_old); //取得本地时间结构体
tmp->tm_year=2015-1900;
tmp->tm_mon = 1-1; //更改其它部分
tmp->tm_mday= 4;
tmp->tm_hour= 0;
tmp->tm_min = 0;
tmp->tm_sec = 0;
lt_old = mktime(tmp); //返回修改时间的长整形数据
m=b+(a-2015)*52;
m=m*7*24*3600+c*3600*24;
now=lt_old+m;
tp=localtime(&now);
return tp->tm_mday;
}