我是菜鸟。大家帮忙看看错误啊。调用怎么弄?
#include <iostream>#include <cmath>
#define PI 3.14159
using namespace std;
class tux
{
public:
float area;
int y,j,z;
int flag;
void choice()
{
cout<<"请输入您要求的图形类型|1:圆形,2:矩形,3:正方形:"<<endl;
cin>>flag;
}
void yuan()
{
float r;
cout<<"请输入半径:"<<endl;
cin>>r;
area=PI*r*r;
cout<<area<<endl;
}
void juxing()
{
float a;
float b;
cout<<"请输入长和宽:"<<endl;
area=a*b;
}
void fangx()
{
float x;
cout<<"请输入边长:"<<endl;
area=x*x;
}
};
int main()
{
int y,j,z;
int flag;
tux mj;
mj.choice();
if (flag==1)
mj.yuan();
else if
(flag==2)
mj.juxing();
else
mj.fangx();
/*switch(flag)
{
case y:mj.yuan();break;
case j:mj.juxing();break;
case z:mj.fangx();break;
default: break;
}*/
//mj.output();
return 0;
}