1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include<iostream>
using namespace std;
class Rect
{
int a, b, c, d;
public:
Rect (int, int, int, int);
int perimeter()
{
return (a + b + c + d);
}
};
Rect::Rect(int one, int two, int three, int four)
{
one = a;
two = b;
three = c;
four = d;
}
int main()
{
Rect uno (1,1,1,1);
Rect dos (4,11,4,6);
cout << "Rect 1 P: " << uno.perimeter() << endl;
cout << "Rect 2 P: " << dos.perimeter() << endl;
return 0;
}
|