#include<iostream.h>
#include<stdlib.h>
class p
{
void w()
{
int x,s,s1,s2,s3;
cout<<"请输入行李的重量x";
cin>>x;
}
int a()
{
if(x>25)
s1=120;
else
s1=(x-15)*12;
}
int b()
{
if(x>45)
s2=300;
else
s2=(x-25)*15;
}
int c()
{
if(x>80)
s3=(x-80)*30+700;
else
s3=(x-45)*20;
}
void main()
{
p o;
o.w();
if(x<=15)s=o;
else
if(x<=25)s=o.a(x);
else
if(x<=45)s=o.a(x)+o.b(x);
else
s=o.a(x)+o.b(x)+o.c(x);
cout<<"您的行李应收费为:"<<s<<"元"<<endl;
}
}
运行不出来,水平有限,不会找错误了 ,,哪位高手帮找找错误吧。 |