mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
570 lines
6.8 KiB
570 lines
6.8 KiB
4 years ago
|
# quadrangle
|
||
4 years ago
|
|
||
4 years ago
|
## quadA
|
||
4 years ago
|
|
||
|
### Instructions
|
||
|
|
||
4 years ago
|
Write a function `QuadA` that prints a **valid** rectangle of width `x` and of height `y`.
|
||
4 years ago
|
|
||
|
The function must draw the rectangles as in the examples.
|
||
|
|
||
|
`x` and `y` will always be positive numbers. Otherwise, the function should print nothing.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
4 years ago
|
func QuadA(x,y int) {
|
||
4 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here are possible programs to test your function :
|
||
|
|
||
|
Program #1
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadA(5,3)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
o---o
|
||
|
| |
|
||
|
o---o
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #2
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadA(5,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
o---o
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #3
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadA(1,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
o
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #4
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadA(1,5)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
o
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
o
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
----
|
||
|
|
||
4 years ago
|
## quadB
|
||
4 years ago
|
|
||
|
### Instructions
|
||
|
|
||
4 years ago
|
Write a function `QuadB` that prints a **valid** rectangle of width `x` and of height `y`.
|
||
4 years ago
|
|
||
|
The function must draw the rectangles as in the examples.
|
||
|
|
||
|
`x` and `y` will always be positive numbers. Otherwise, the function should print nothing.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
4 years ago
|
func QuadB(x,y int) {
|
||
4 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here are possible programs to test your function :
|
||
|
|
||
|
Program #1
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadB(5,3)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
/***\
|
||
|
* *
|
||
|
\***/
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #2
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadB(5,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
/***\
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #3
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadB(1,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
/
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #4
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadB(1,5)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
/
|
||
|
*
|
||
|
*
|
||
|
*
|
||
|
\
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
----
|
||
|
|
||
4 years ago
|
## quadC
|
||
4 years ago
|
|
||
|
### Instructions
|
||
|
|
||
4 years ago
|
Write a function `QuadC` that prints a **valid** rectangle of width `x` and of height `y`.
|
||
4 years ago
|
|
||
|
The function must draw the rectangles as in the examples.
|
||
|
|
||
|
`x` and `y` will always be positive numbers. Otherwise, the function should print nothing.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
4 years ago
|
func QuadC(x,y int) {
|
||
4 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here are possible programs to test your function :
|
||
|
|
||
|
Program #1
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadC(5,3)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBA
|
||
|
B B
|
||
|
CBBBC
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #2
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadC(5,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBA
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #3
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadC(1,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #4
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadC(1,5)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
B
|
||
|
B
|
||
|
B
|
||
|
C
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
----
|
||
|
|
||
4 years ago
|
## quadD
|
||
4 years ago
|
|
||
|
### Instructions
|
||
|
|
||
4 years ago
|
Write a function `QuadD` that prints a **valid** rectangle of width `x` and of height `y`.
|
||
4 years ago
|
|
||
|
The function must draw the rectangles as in the examples.
|
||
|
|
||
|
`x` and `y` will always be positive numbers. Otherwise, the function should print nothing.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
4 years ago
|
func QuadD(x,y int) {
|
||
4 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here are possible programs to test your function :
|
||
|
|
||
|
Program #1
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadD(5,3)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBC
|
||
|
B B
|
||
|
ABBBC
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #2
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadD(5,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBC
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #3
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadD(1,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #4
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadD(1,5)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
B
|
||
|
B
|
||
|
B
|
||
|
A
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
----
|
||
|
|
||
4 years ago
|
## quadE
|
||
4 years ago
|
|
||
|
### Instructions
|
||
|
|
||
4 years ago
|
Write a function `QuadE` that prints a **valid** rectangle of width `x` and of height `y`.
|
||
4 years ago
|
|
||
|
The function must draw the rectangles as in the examples.
|
||
|
|
||
|
`x` and `y` will always be positive numbers. Otherwise, the function should print nothing.
|
||
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
4 years ago
|
func QuadE(x,y int) {
|
||
4 years ago
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here are possible programs to test your function :
|
||
|
|
||
|
Program #1
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadE(5,3)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBC
|
||
|
B B
|
||
|
CBBBA
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #2
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadE(5,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
ABBBC
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #3
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadE(1,1)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|
||
|
|
||
|
Program #4
|
||
|
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import piscine ".."
|
||
|
|
||
|
func main() {
|
||
4 years ago
|
piscine.QuadE(1,5)
|
||
4 years ago
|
}
|
||
|
```
|
||
|
|
||
|
And its output :
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/[[ROOT]]/test$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/test$ ./test
|
||
|
A
|
||
|
B
|
||
|
B
|
||
|
B
|
||
|
C
|
||
|
student@ubuntu:~/[[ROOT]]/test$
|
||
|
```
|