#include<stdio.h> int main(void) { int choice,i; double price; for(i=1;i<=5;i++){ printf("[1]Select apple \n"); printf("[2]Select rears \n"); printf("[3]Select oranges \n"); printf("[4]Select grapes \n"); printf("[0]exit \n"); printf("Enter choice:"); scanf("%d",&choice); if(choice==0) break; switch(choice){ case 1:price=3.00;break;/*跳出switch语句*/
case 2:price=2.50;break; case 3:price=4.10;break; case 4:price=10.20;break; default:price=0.00;break; } printf("price=%0.2f\n",price); }
转载于:https://www.cnblogs.com/lvdingding13588022785/p/3379486.html