#include <iostream>
using namespace std;
class rec
{
int x,y;
public:
void set_values(int,int);
int area(){return (x*y);}
};
void rec::set_values(int a, int b)
{
x=a;
y=b;
}
int main()
{
rec rect;
rect.set_values(3,4);
cout << "area: "<< rect.area();
system("pause");
return 0;
}
The Output is Given Below:
12
0 comments:
Post a Comment