码迷,mamicode.com
首页 > 编程语言 > 详细

fenby C语言 P13

时间:2015-05-14 18:19:36      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

开关语句switch(变量)

switch(weekday)

            ↓

          数字

default:异常处理

case-break

#include <stdio.h>

int main()

{

int weekday=3;

switch(weekday)

{

case 1:

printf("today is Monday\n");

break;

case 2:

printf("today is Tuesday\n");

break;

case 3:

printf("today is Wednesday\n");

break;

case 4:

printf("today is Thursday\n");

break;

case 5:

printf("today is Friday\n");

break;

case 6:

printf("today is Saturday\n");

break;

case 7:

printf("today is Sunday\n");

break;

default:

printf("You write the wrong number!");

break;

}

return 0;

}

fenby C语言 P13

标签:

原文地址:http://www.cnblogs.com/amiaojiang/p/4503592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!