public/subjects/quad/README.md

554 lines
5.2 KiB
Markdown
Raw Permalink Normal View History

## quadrangle
2020-07-30 10:11:28 +00:00
### quadA
2020-07-30 10:11:28 +00:00
#### Instructions
2020-07-30 10:11:28 +00:00
Write a function `QuadA` that prints a **valid** rectangle with a given width of `x` and height of `y`.
2020-07-30 10:11:28 +00:00
The function must draw the rectangles as in the examples.
2021-10-27 15:46:30 +00:00
If `x` and `y` are positive numbers, the program should print the rectangles as seen in the examples, otherwise, the function should print nothing.
2020-07-30 10:11:28 +00:00
Make sure you submit all the necessary files to run the program.
#### Expected function
2020-07-30 10:11:28 +00:00
```go
func QuadA(x,y int) {
2020-07-30 10:11:28 +00:00
}
```
#### Usage
2020-07-30 10:11:28 +00:00
Here are possible programs to test your function :
Program #1
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadA(5,3)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
o---o
| |
o---o
$
2020-07-30 10:11:28 +00:00
```
Program #2
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadA(5,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
o---o
$
2020-07-30 10:11:28 +00:00
```
Program #3
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadA(1,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
o
$
2020-07-30 10:11:28 +00:00
```
Program #4
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadA(1,5)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
o
|
|
|
o
$
2020-07-30 10:11:28 +00:00
```
2021-04-27 19:04:54 +00:00
---
2020-07-30 10:11:28 +00:00
### quadB
2020-07-30 10:11:28 +00:00
#### Instructions
2020-07-30 10:11:28 +00:00
Write a function `QuadB` that prints a **valid** rectangle of width `x` and of height `y`.
2020-07-30 10:11:28 +00:00
The function must draw the rectangles as in the examples.
2021-10-27 15:46:30 +00:00
If `x` and `y` are positive numbers, the program should print the rectangles as seen in the examples, otherwise, the function should print nothing.
2020-07-30 10:11:28 +00:00
#### Expected function
2020-07-30 10:11:28 +00:00
```go
func QuadB(x,y int) {
2020-07-30 10:11:28 +00:00
}
```
#### Usage
2020-07-30 10:11:28 +00:00
Here are possible programs to test your function :
Program #1
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadB(5,3)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
/***\
* *
\***/
$
2020-07-30 10:11:28 +00:00
```
Program #2
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadB(5,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
/***\
$
2020-07-30 10:11:28 +00:00
```
Program #3
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadB(1,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
/
$
2020-07-30 10:11:28 +00:00
```
Program #4
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadB(1,5)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
/
*
*
*
\
$
2020-07-30 10:11:28 +00:00
```
2021-04-27 19:04:54 +00:00
---
2020-07-30 10:11:28 +00:00
### quadC
2020-07-30 10:11:28 +00:00
#### Instructions
2020-07-30 10:11:28 +00:00
Write a function `QuadC` that prints a **valid** rectangle of width `x` and of height `y`.
2020-07-30 10:11:28 +00:00
The function must draw the rectangles as in the examples.
2021-10-27 15:46:30 +00:00
If `x` and `y` are positive numbers, the program should print the rectangles as seen in the examples, otherwise, the function should print nothing.
2020-07-30 10:11:28 +00:00
#### Expected function
2020-07-30 10:11:28 +00:00
```go
func QuadC(x,y int) {
2020-07-30 10:11:28 +00:00
}
```
#### Usage
2020-07-30 10:11:28 +00:00
Here are possible programs to test your function :
Program #1
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadC(5,3)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBA
B B
CBBBC
$
2020-07-30 10:11:28 +00:00
```
Program #2
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadC(5,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBA
$
2020-07-30 10:11:28 +00:00
```
Program #3
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadC(1,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
$
2020-07-30 10:11:28 +00:00
```
Program #4
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadC(1,5)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
B
B
B
C
$
2020-07-30 10:11:28 +00:00
```
2021-04-27 19:04:54 +00:00
---
2020-07-30 10:11:28 +00:00
### quadD
2020-07-30 10:11:28 +00:00
#### Instructions
2020-07-30 10:11:28 +00:00
Write a function `QuadD` that prints a **valid** rectangle of width `x` and of height `y`.
2020-07-30 10:11:28 +00:00
The function must draw the rectangles as in the examples.
2021-10-27 15:46:30 +00:00
If `x` and `y` are positive numbers, the program should print the rectangles as seen in the examples, otherwise, the function should print nothing.
2020-07-30 10:11:28 +00:00
#### Expected function
2020-07-30 10:11:28 +00:00
```go
func QuadD(x,y int) {
2020-07-30 10:11:28 +00:00
}
```
#### Usage
2020-07-30 10:11:28 +00:00
Here are possible programs to test your function :
Program #1
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadD(5,3)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBC
B B
ABBBC
$
2020-07-30 10:11:28 +00:00
```
Program #2
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadD(5,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBC
$
2020-07-30 10:11:28 +00:00
```
Program #3
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadD(1,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
$
2020-07-30 10:11:28 +00:00
```
Program #4
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadD(1,5)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
B
B
B
A
$
2020-07-30 10:11:28 +00:00
```
2021-04-27 19:04:54 +00:00
---
2020-07-30 10:11:28 +00:00
### quadE
2020-07-30 10:11:28 +00:00
#### Instructions
2020-07-30 10:11:28 +00:00
Write a function `QuadE` that prints a **valid** rectangle of width `x` and of height `y`.
2020-07-30 10:11:28 +00:00
The function must draw the rectangles as in the examples.
2021-10-27 15:46:30 +00:00
If `x` and `y` are positive numbers, the program should print the rectangles as seen in the examples, otherwise, the function should print nothing.
2020-07-30 10:11:28 +00:00
#### Expected function
2020-07-30 10:11:28 +00:00
```go
func QuadE(x,y int) {
2020-07-30 10:11:28 +00:00
}
```
#### Usage
2020-07-30 10:11:28 +00:00
Here are possible programs to test your function :
Program #1
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadE(5,3)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBC
B B
CBBBA
$
2020-07-30 10:11:28 +00:00
```
Program #2
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadE(5,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
ABBBC
$
2020-07-30 10:11:28 +00:00
```
Program #3
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadE(1,1)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
$
2020-07-30 10:11:28 +00:00
```
Program #4
```go
package main
import "piscine"
2020-07-30 10:11:28 +00:00
func main() {
piscine.QuadE(1,5)
2020-07-30 10:11:28 +00:00
}
```
And its output :
```console
$ go run .
2020-07-30 10:11:28 +00:00
A
B
B
B
C
$
2020-07-30 10:11:28 +00:00
```