switch中奖号码

#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语句来练习

posted @ 2015-11-01 19:31  魔都初心  阅读(184)  评论(0编辑  收藏  举报