[原创]
#include<iostream.h>
const float pi=(float)3.14159;
const float fenceprice=30.0;
const float concreteprice=20.0;
class circle
{
public:
circle(float r);
float circumference();
float area();
private:
float radius;
}
circle::circle(float r){radius=r;}
float circle::circumference()
{
return 2*pi*radius;
}
float circle::area()
{
return pi*radius*radius;
}
void main()
{
float radius;
float fencecost,concretecost;
cout<<"输入圆的半径:";
cin>>radius;
circle pool(radius);
circle poolrim(radius+3);
fencecost=poolrim.circumference()*fenceprice;
cout<<"fencing cost is :"<<fencecost<<"元"<<endl;
concretecost=(poolrim.area()-pool.area())*concreteprice;
cout<<"栅栏的花费"<<concretecost<<"元"<<endl;
}
大家帮我调试一下了 有三个错误 希望大家给点意见