重载函数最后那里怎么输出的输出不了,在break前面那里输出
#include <iostream>using namespace std;
double area(int x)
{
int area;
area=x*x;
return area;
}
double area(int x,int y)
{
int area;
area=x*y;
return area;
}
double area(double c,double d)
{
double area;
area=0.5*c*d;
return area;
}
double area(double c)
{
double area;
area=3.14*c*c;
return area;
}
int main()
{
char pic;
int x,y;
double c ,d,s;
cout<<"正方形为1,长方形为2,三角形为3,圆形为4"<<endl;
cout<<"输入所求图形是什么用数字表示"<<endl;
cin>>pic;
switch(pic)
{
case '1':
cout<<"输入正方形边长以整数形式输入"<<endl;
cin>>x;
s=double area(int x);
cout<<"正方形面积为="<<s<<endl;
break;
case '2':
cout<<"输入长方形边长以整数形式输入"<<endl;
cin>>x>>y;
double area(int x,int y);
cout<<"长方形面积为="<<endl;
break;
case '3':
cout<<"输入三角形的底和高以小数形式输入"<<endl;
cin>>c>>d;
double area(double c,double d);
cout<<"三角形面积为="<<endl;
break;
case '4':
cout<<"输入圆形半径以小数形式输入"<<endl;
cin>>c;
double area(double c);
cout<<"圆形形面积为="<<endl;
break;
return 0;
}
}