0
已解决
周天睿
初级光能
初级光能
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
float x,a=3.00,b=2.50,c=4.50,d=9.50;
cin>>x;
if(x==1)
{
printf("%.1f",a);
}
if(x==2)
{
printf("%.1f",b);
}
if(x==3)
{
printf("%.1f",c);
}
if(x==4)
{
printf("%.1f",d);
}
if(x==0)
{
cout<<"Exit";
}
else
cout<<0;
return 0;
}
请大佬们看一下,我0分!
0
已采纳
陆麟瑞
资深天翼
资深天翼
先输出[1] apples
[2] pears
[3] oranges
[4] grapes
[0] Exit
在计算price
cout<<"[1] apples"<<endl; cout<<"[2] pears"<<endl; cout<<"[3] oranges"<<endl; cout<<"[4] grapes"<<endl; cout<<"[0] Exit"<<endl; cin>>n; if(n!=0)cout<<"price="; if(n==1) cout<<"3.0"; else if(n==2) cout<<"2.5"; else if(n==3) cout<<"4.5"; else if(n==4) cout<<"9.5"; else if(n!=0) cout<<0;
0
0