#include<stdio.h> int main(void) { int i,x; double price; for(i=1;i<=5;i++){ printf("[1]apples "); printf("[2]pears "); printf("[3]oranges "); printf("[4]grapes "); printf("[0]exit "); printf("输入编号: "); scanf("%d",&x); if(x==0) break; switch(x){ case 1:price=3.00;break; 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=%.3f",price); } return 0; }