码迷,mamicode.com
首页 > 其他好文 > 详细

练习0002 switch

时间:2015-11-01 21:05:48      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

#include<stdio.h>
int main(void)
{
    int choice=0;
    printf("\nPick a number between 1 and 10 and you may win a prize!");
    scanf("&d",choice);
    if((choice>10)||(choice<1))
        choice=11;
    switch(choice)
    {
    case 7:
        printf("\nCongratulations!");
        printf("\nYou win the collectde works of Amos  Grunt futtock.");
        break;
    default:
        printf("\n Sorry,you lose.\n");
        break;
    }
    return 0;
}

简单的switch语句来练习

练习0002 switch

标签:

原文地址:http://www.cnblogs.com/flywolf601/p/4928447.html

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