| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 跟大牛学C++学算法数据结构

已结贴   问题点数：5  回复次数：7

#include<stdio.h>
void main()
{
int year,month;
printf("input year and month:");
scanf("%d%d",&year,&month);
if(month==2)
{
if((year%4==0&&year%100!==0)||(year%400==0))
printf("the days of %d of %d is 29",year,month");
else printf("the days of %d of %d is 28",year,month");
}
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:prtinf("the days of %d of %d is 31",year,month);break;
case 4:
case 6:
case 8:
case 11:prtinf("the days of %d of %d is 30",year,month);break;
default:printf("error input!\n");
}
}
10 errors,1 warning

得分:5

#include<stdio.h>
void main()
{
int year,month;
printf("input year and month:");
scanf("%d%d",&year,&month);
if(month==2)
{
if((year%4==0&&year%100!=0)||(year%400==0))
printf("the days of %d of %d is 29",year,month);
else printf("the days of %d of %d is 28",year,month);
}
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:printf("the days of %d of %d is 31",year,month);break;
case 4:
case 6:
case 9:
case 11:printf("the days of %d of %d is 30",year,month);break;
default:printf("error input!\n");
}
}

printf("萌新一枚，请多指教");
得分:0
printf不是prtinf  基本的输出函数要记清楚！  !=(不等于要这样写)，不能写成！==

得分:0

得分:0

得分:0

得分:0

#include<stdio.h>
void main()
{
int year,month;
printf("input year and month:");
scanf("%d%d",&year,&month);
if(month==2)
{
if((year%4==0&&year%100!=0)||(year%400==0))
printf("the days of %d of %d is 29",year,month);
else printf("the days of %d of %d is 28",year,month);
}
else
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:printf("the days of %d of %d is 31",year,month);break;
case 4:
case 6:
case 9:
case 11:printf("the days of %d of %d is 30",year,month);break;
default:printf("error input!\n");
}
}
}
得分:0

#include<stdio.h>
void main()
{
int year,month;
printf("input year and month:");
scanf("%d%d",&year,&month);
switch(month)
{
case 1:printf("the days of %d of %d is 31",year,month);break;
case 2:
if((year%4==0&&year%100!=0)||(year%400==0))
printf("the days of %d of %d is 29",year,month);
else printf("the days of %d of %d is 28",year,month);
break;
case 3 :printf("the days of %d of %d is 31",year,month);break;
case 4 :printf("the days of %d of %d is 30",year,month);break;
case 5 :printf("the days of %d of %d is 31",year,month);break;
case 6 :printf("the days of %d of %d is 30",year,month);break;
case 7 :printf("the days of %d of %d is 31",year,month);break;
case 8 :printf("the days of %d of %d is 31",year,month);break;
case 9 :printf("the days of %d of %d is 30",year,month);break;
case 10:printf("the days of %d of %d is 31",year,month);break;
case 11:printf("the days of %d of %d is 30",year,month);break;
case 12:printf("the days of %d of %d is 31",year,month);break;
default:printf("error input!\n");
}
}
}

[此贴子已经被作者于2018-4-17 09:29编辑过]

-18.06.21
• 8
• 1/1页
• 1