纠错,帮帮忙,看看你的基本工

来源:百度知道 编辑:UC知道 时间:2024/06/04 03:37:35
#include <iostream>
#include <math.h>
using namespace std;
class CCylinder
{
public:
CCylinder(float a,float b)
{
radius=a;
high=b;

}
CCylinder(){}
float Volume();
void Show()
{
cout<<"半径:"<<radius<<endl;
cout<<"高:"<<high<<endl;
cout<<"体积:"<<Volume()<<endl;
}
private:
float radius;
float high;
};
float CCylinder::Volume()
{
return (float)pow(radius,2)*3.14*high;
}
int main()
{
butter=new CCylinder(10,10);
// butter.Volume();
butter.Show();
return 0;
}
报错: fatal error C1010: unexpected end of file while looking for precompiled header directive

改好了,如下,我编译通过

#include <iostream>
#include <math.h>

using namespace std;

class CCylinder
{
public:
CCylinder( float a, float b )
{
radius = a;
high = b;

}

CCylinder()
{}

float Volume();
void Show()
{
cout << "半径:" << radius << endl;
cout << "高:" << high << endl;
cout << "体积:" << Volume() << endl;
}

private:
float radius;
float high;
};

float CCylinder::Volume()
{
return ( float ) pow( radius, 2 ) * 3.14 * high;
}

int main()
{
CCylinder * butter = new CCylinder( 10, 10 );
// butter->Volume();
butter->Show();
return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
class CCylinder