-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoneFourth.cpp
More file actions
38 lines (34 loc) · 803 Bytes
/
Copy pathoneFourth.cpp
File metadata and controls
38 lines (34 loc) · 803 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
30
31
32
33
34
35
36
37
38
//============================================================================
// Name : oneFourth.cpp
//============================================================================
#include <iostream>
int main() {
int s;
std::cout << "Specify the size (should be an even number):";
std::cin >> s;
char basic [s/2][s/2];
for (int i=0;i<s/2;i++){
for(int j=0; j<s/2;j++){
if(i==0||i==j){
basic[i][j]=basic[i][0] = '#';
}
else{
basic[i][j]=' ';
}
}
}
for (int i=0;i<s;i++){
for(int j=0; j<s;j++){
if(i<s/2 && j<s/2){
std::cout << basic[i][j];
}else if(i<s/2 && j>=s/2){
std::cout << basic[i][s-j-1];
}else if(i>=s/2 && j<s/2){
std::cout << basic[s-i-1][j];
}else{
std::cout << basic[s-j-1][s-i-1];
}
}
std::cout << '\n';
}
}