i want to write a program can caulate the area of a circle and squar
using overloaded functions, i tried but it didnt work , what i missing here ?
#include<iostream>
using namespace std;
class math
{
int r;
double d;
public:
void set_value(int t)
{
r = t;
}
void set_value2(double f)
{
d=f;
}
int area (int )
{
return r*r;
}
int area(double)
{
return d*d;
}
};
int main()
{
int y,u,g,h;
char c;
math cir,squ;
cout<<"Enter the redius:\n";// for the circle
cin>>y;
cir.set_value(y);
u=cir.area(int);
cout<< "area of the circle = " << u;
cout << "Enter the side size:\n";// for the square
cin>> g;
squ.set_value2(g);
h=squ.area(double);
cout<<" area of the square = " << h;
cin>>c;
return 0;
}