-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquadC.go
More file actions
48 lines (45 loc) · 829 Bytes
/
quadC.go
File metadata and controls
48 lines (45 loc) · 829 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
39
40
41
42
43
44
45
46
47
48
package piscine
import "github.com/01-edu/z01"
// corner topleft always there
// corner topright if x!=1
// corner bottomleft if y!=1
// corner bottomright if x!=1 && y!=1
func QuadC(x, y int) {
if x > 0 && y > 0 {
z01.PrintRune('A')
for i := 2; i < x; i++ {
z01.PrintRune('B')
}
if x != 1 {
z01.PrintRune('A')
}
z01.PrintRune('\n')
// first line ends here
if y != 1 {
for j := 2; j < y; j++ {
z01.PrintRune('B')
for i := 2; i < x; i++ {
z01.PrintRune(' ')
}
if x != 1 {
z01.PrintRune('B')
}
z01.PrintRune('\n')
}
}
// middle line ends here
if y != 1 {
z01.PrintRune('C')
}
if x != 1 && y != 1 {
for i := 2; i < x; i++ {
z01.PrintRune('B')
}
z01.PrintRune('C')
// z01.PrintRune('\n')
}
if y != 1 {
z01.PrintRune('\n')
}
}
}