c++编程
#include"iostream"class area
{
int x,y,r,b,h;
public :
int getarea(int x,int y,int a);
float getarea(int r);
float getarea(int b,int h);
};
int area::getarea(int x,int y,int a)
{
int s;
s=x*y;
return (s);
}
float area::getarea(int r)
{int s1;
s1=r*r*3.1416;
return (s1);}
float area::getarea(int b,int h)
{
int s2;
s2=b*h/2;
return (s2);
}
void main()
{
area m;
m.getarea(10,20,30);
m.getarea(20);
m.getarea(10,20);
}
为什么这个编程在c++中编译时是对的,但在运行时为什么还要自己输入数字呢?请各位师兄妹指点一下,谢谢!