#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语句来练习
时间: 2024-10-16 00:31:26