-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11693
More file actions
92 lines (80 loc) · 1.65 KB
/
Copy path11693
File metadata and controls
92 lines (80 loc) · 1.65 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
#include <iostream>
using namespace std;
char star [100][100];
int c,f,h,s;
char x;
int all_len;
void show_down(int,int);
void show_up(int high,int length){
star[high][length]='*';
if((star[high-1][length]!='-')&&(high-1==0)){
star[high-1][length+1]='*';
all_len=length+1;
return;
}
else if(star[high-1][length]!='-')
show_up((high-1),(length+1));
else if(star[high-1][length]=='-')
show_down(high+1,length+1);
}
void show_down(int high,int length){
star[high][length]='*';
if((star[high+1][length]!='-')&&(high+1==(h+1))){
star[high+1][length+1]='*';
all_len=length+1;
return;
}
else if(star[high+1][length]!='-')
show_down((high+1),(length+1));
else if(star[high+1][length]=='-')
show_up(high-1,length+1);
}
int main() {
int i,j;
for(i=0;i<=100;i++)
for(j=0;j<=100;j++)
star[i][j]=' ';
cin>>c>>f>>h;
cin>>s;
cin>>x;
if(s<=h){
for(i=0;i<c;i++)
star[0][i]='-';
for(j=0;j<f;j++)
star[h+1][j]='-';
star[s][0]='*';
if(x=='u')
show_up(s,0);
else if(x=='d')
show_down(s,0);
if(all_len>=c&&all_len>=f){
for(i=0;i<=h+1;i++){
for(j=0;j<=all_len;j++){
cout<<star[i][j];
if(star[i][j]=='\0')
break;
}
cout<<endl;
}
}
else if(c>=all_len&&c>=f){
for(i=0;i<=h+1;i++){
for(j=0;j<c;j++){
cout<<star[i][j];
if(star[i][j]=='\0')
break;
}
cout<<endl;
}
}
else
for(i=0;i<=h+1;i++){
for(j=0;j<f;j++){
cout<<star[i][j];
if(star[i][j]=='\0')
break;
}
cout<<endl;
}
}
}