switch中奖号码

#include<stdio.h>
int main(void)
{
    int choice=0;
    printf("
Pick 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("
Congratulations!");
        printf("
You win the collectde works of Amos  Grunt futtock.");
        break;
    default:
        printf("
 Sorry,you lose.
");
        break;
    }
    return 0;
}

简单的switch语句来练习

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