SHOW:
|
|
- or go back to the newest paste.
1 | - | #include "rectangle.h" |
1 | + | void triangle::draw() |
2 | - | #include <string> |
2 | + | |
3 | - | #include <iostream> |
3 | + | for(int x = 0; x < leg; x++) |
4 | - | using namespace std; |
4 | + | |
5 | - | |
5 | + | if(d == LEFT) |
6 | - | rectangle::rectangle() |
6 | + | |
7 | for(int y = 0; y < x + 1; y++) | |
8 | - | this->description="I am a rectangle"; |
8 | + | |
9 | - | } |
9 | + | if(x == leg - 1 || y == 0 || y == x) |
10 | - | |
10 | + | { |
11 | - | rectangle::rectangle(string desIn, int hIn, int wIn) |
11 | + | cout << "+ "; |
12 | } | |
13 | - | this->description=desIn; |
13 | + | else |
14 | - | height = hIn; |
14 | + | { |
15 | - | width = wIn; |
15 | + | cout << " "; |
16 | - | } |
16 | + | } |
17 | - | |
17 | + | |
18 | - | void rectangle::set(int hIn, int wIn) |
18 | + | cout << endl; |
19 | } | |
20 | - | height = hIn; |
20 | + | else |
21 | - | width = wIn; |
21 | + | |
22 | - | } |
22 | + | for(int y = 0; y < leg; y++) |
23 | - | void rectangle::draw() |
23 | + | |
24 | if(y == leg - 1 || x == leg - 1 || y == leg - x - 1) | |
25 | - | for(int x = 0; x < height; x++) |
25 | + | { |
26 | cout << "+ "; | |
27 | - | for(int y = 0; y < width; y++) |
27 | + | } |
28 | else | |
29 | - | if(x == 0 || x == height - 1 || y == 0 || y == width - 1) |
29 | + | { |
30 | cout << " "; | |
31 | - | cout << "+ "; |
31 | + | } |
32 | } | |
33 | - | else |
33 | + | cout << endl; |
34 | } | |
35 | - | cout << " "; |
35 | + | |
36 | } |