-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·122 lines (105 loc) · 3.21 KB
/
main.cpp
File metadata and controls
executable file
·122 lines (105 loc) · 3.21 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include "shape.h"
#include "circle.h"
#include "quadrilateral.h"
#include "rectangle.h"
#include "parallelogram.h"
#include <string>
using namespace std;
int main()
{
//cout << "enter nam, col, radius, angle1, angle2, width and height ";
string nam, col; double rad = 0, ang = 0, ang2 = 0; int height = 0, width = 0;
//cin >> nam >> col >> rad >> width >> height;
Circle circ(col, nam, rad);
quadrilateral quad(nam, col, width, height);
rectangle rec(nam, col, width, height);
parallelogram para(nam, col, width, height, ang, ang2);
Shape *ptrcirc = ˆ
Shape *ptrquad = &quad;
Shape *ptrrec = &rec;
Shape *ptrpara = ¶
/*ptrcirc->draw();
ptrquad->draw();
ptrrec->draw();
ptrpara->draw();*/
//-----------------------
cout << "Enter information for your objects" << endl;
const char circle = 'c', quadrilateral = 'q', rectangle = 'r', parallelogram = 'p'; char shapetype;
char x = 'y';
while (x != 'x') {
cout << "which shape would you like to work with?.. \nc=circle, q = quadrilateral, r = rectangle, p = parallelogram" << endl;
cin >> shapetype;
switch (shapetype) { //SWITCHH !
case 'c':
cout << "enter col, nam, rad for circle" << endl;
cin >>col>> nam>>rad;
circ.setColor(col);
circ.setName(nam);
circ.setRad(rad);//only accesses simliar functions
ptrcirc->draw(); //or (*ptrcirc).draw();
//CAL AREA IS PART OF DRAW but virtual
break;
case 'q':
cout << "enter nam, col, height, width" <<endl;
cin >> nam >> col >> height >> width;
quad.setName(nam);
quad.setColor(col);
quad.setHeight(height);
quad.setWidth(width);
ptrquad->draw();
break;
case 'r':
cout << "enter nam, col, height, width" << endl;
cin >> nam>> col>> height>>width;
rec.setName(nam);
rec.setColor(col);
rec.setHeight(height);
rec.setWidth(width);
ptrrec->draw();
break;
case 'p':
cout << "enter nam, col, height, width, 2 angles" << endl;
cin >> nam>> col>> height>> width>> ang>> ang2;
para.setName(nam);
para.setColor(col);
para.setHeight(height);
para.setWidth(width);
para.setAngle(ang,ang2);
ptrpara->draw();
default:
cout<< "you have entered an invalid, please re-enter" << endl;
break;
}
cout << "would you like to add more object press y if not press x" << endl;
cin >> x;
}
/*Circle circ(col, nam, rad);
Shape *ptrcirc = ˆ
cout << "FOR CIRCLE:" << endl;
ptrcirc->draw();
//x++;*/
/*//Shape s("no Shape", "no Color");
//s.draw();
cout << "------Circle------------";
Circle c("Ruby", "red", 5);
//c.setRad(5);
c.draw();
//cout<<c.CalArea(5, 4);
cout << "-----Quadrilateral---------" << endl;
quadrilateral q("Sapphire", "blue", 6, 7);
q.draw();
cout << "------Rectangle-----------" << endl;
rectangle r("Emerald", "green", 2, 3);
r.draw(); //fixxxed
cout << "--Parallelogram--------" << endl;
parallelogram p("Pearl", "White", 8, 9, 30, 60);
p.draw();
cout << "-----------"<<endl;
cout << "Counter is " << Shape::getCount() << endl<<endl;
//cout << Shape::getCount();
*/
//cout << p.CalArea();//fixxed
system("pause");
return 0;
}