-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (26 loc) · 902 Bytes
/
main.cpp
File metadata and controls
29 lines (26 loc) · 902 Bytes
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
#include <iostream>
using namespace std ;
#include "geometry.h"
void printAttributes(Polygon *p){
cout << " p’s area is " << p -> area()<<".\ n";
cout << " p’s points are :\n";
const PointArray *pa = p -> getPoints();
for(int i = 0; i < pa -> getSize() ; ++ i){
cout <<"(" << pa -> get(i)->getX() << ", " << pa->get(i)->getY () << " )\n";
}
}
int main ( int argc, char *argv[]) {
cout << " Enter lower left and upper right coords of rectangle as four space separated integers : ";
int llx , lly , urx , ury;
cin >> llx >> lly >> urx >> ury;
Point ll ( llx , lly ) , ur ( urx , ury );
Rectangle r(ll, ur );
printAttributes (&r);
cout << " Enter three coords of triangle as six space separated integers : " ;
int x1 , y1 , x2 , y2 , x3 , y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
Point a(x1, y1), b(x2, y2), c(x3 , y3);
Triangle t(a, b, c);
printAttributes(&t);
return 0;
}