#include<stdio.h> int main(void) { int choice,i; double price;
for(i=1;i<=5;i++){ printf("[1]Select crispsn"); printf("[2]Select popcornn"); printf("[3]Select chocolaten"); printf("[4]Select colan"); printf("[0]exitn");
printf("Enter choice:"); scanf("%d",&choice);
if(choice==0) break; switch(choice){ case 1:price=3.0;break; case 2:price=2.5;break; case 3:price=4.0;break; case 4:price=3.5;break; default:price=0.0;break; } printf("price=%0.1fn",price); } printf("Thanksn"); return 0; }
for(i=1;i<=5;i++){ printf("[1]Select crispsn"); printf("[2]Select popcornn"); printf("[3]Select chocolaten"); printf("[4]Select colan"); printf("[0]exitn");
printf("Enter choice:"); scanf("%d",&choice);
if(choice==0) break; switch(choice){ case 1:price=3.0;break; case 2:price=2.5;break; case 3:price=4.0;break; case 4:price=3.5;break; default:price=0.0;break; } printf("price=%0.1fn",price); } printf("Thanksn"); return 0; }
转载于:https://www.cnblogs.com/2013djj/p/3353756.html
最后
以上就是故意大树最近收集整理的关于例3-8的全部内容,更多相关例3-8内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复