| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1990 人关注过本帖
标题:请教一下,这个关于switch的语句~
取消只看楼主 加入收藏
只剩云淡风轻
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-4-15
结帖率:50%
收藏
已结贴  问题点数:5 回复次数:2 
请教一下,这个关于switch的语句~
要求输入年份和月份 得出本月天数
#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      
不太清楚错在哪里了 请指教qaq
搜索更多相关主题的帖子: switch year printf the case 
2018-04-15 16:35
只剩云淡风轻
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-4-15
收藏
得分:0 
回复 2楼 ab1412
谢谢您哈~
2018-04-15 17:48
只剩云淡风轻
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2018-4-15
收藏
得分:0 
回复 3楼 a451410
一时疏忽。。Thanks♪(・ω・)ノ蟹蟹~
2018-04-15 17:49
快速回复:请教一下,这个关于switch的语句~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012250 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved