|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
写计算周几的问题时出现了以下错误,大佬帮看看。
F:\c\main.o main.c:(.text+0x19c): undefined reference to `peintf'
F:\c\collect2.exe [Error] ld returned 1 exit status
25 F:\c\Makefile.win recipe for target 'Project1.exe' failed
代码如下:
#include <stdio.h>
#include <math.h>
void main()
{
int year,mouth,day,l,m,n,sum,days,week;
int leap(int i);
printf("input\n");
scanf("%d %d %d",&year,&mouth,&day);
sum=0;
for(m=1;m<year;m++)//计算闰年数
{
n=leap(m);
if(n==1)
{
sum=sum+1;
}
}
days=365*year+sum;//计算(year-1)年天数
switch(mouth-1)
{
case 11:days=days+30;
case 10:days=days+31;
case 9:days=days+30;
case 8:days=days+31;
case 7:days=days+31;
case 6:days=days+30;
case 5:days=days+31;
case 4:days=days+30;
case 3:days=days+31;
case 2:
{
l=leap(year);
if(l==1)
{
days=days+29;
}
else
{
days=days+28;
}
}
case 1:days=days+31;
case 0:days=days+0;
}
days=days+day;//计算总天数
week=days%7;
switch(week)//判断周几
{
case 1:printf("周一");break;
case 2:printf("周二");break;
case 3:printf("周三");break;
case 4:printf("周四");break;
case 5:printf("周五");break;
case 6:peintf("周六");break;
case 7:printf("周日");break;
}
}
int leap(int i)//判断是否是闰年,1为闰年
{
int leap;
if(i%4==0)
{
if(i%400==0||i%100!=0)
{
leap=1;
}
else
leap=0;
}
else
leap=0;
return(leap);
}
第二个switch里的case6那里printf打错了
|
|