作业三-6

#include<stdio.h>
int main(void)
{
    int choice,i;
    double price;
    for(i=1;i<=5;i++){
        printf("[1]select apples\n");
        printf("[2]select pears\n");
        printf("[3]select oranges\n");
        printf("[4]select grapes\n");
        printf("[0]select Exit\n");
        printf("Enter choice:");
        scanf_s("%d",&choice);
        if(choice==0)
            break;
            switch(choice){
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=%0.2f\n",price);
        }
        printf("Thanks\n");
        return 0;
    }

 

posted @ 2013-10-28 09:34  dihuanting  阅读(113)  评论(0编辑  收藏  举报