首页 > 其他 > 详细

练习0002 switch

时间:2015-11-01 21:05:35      阅读:254      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!