Simplify prompt, execution of Go programs, fix typos

This commit is contained in:
xpetit 2021-04-28 11:47:34 +02:00
parent 5cb1e96818
commit 46f4ddc49e
No known key found for this signature in database
GPG Key ID: 97C60669182C17A5
324 changed files with 1047 additions and 1280 deletions

View File

@ -13,19 +13,18 @@ Example: [fprime](https://github.com/01-edu/public/blob/master/subjects/fprime.e
The exceptional cases in the `usage` part.
```console
student@ubuntu:~/piscine-go/test$ go build
student@ubuntu:~/piscine-go/test$ ./test 225225
$ go run . 225225
3*3*5*5*7*11*13
student@ubuntu:~/piscine-go/test$ ./test 8333325
$ go run . 8333325
3*3*5*5*7*11*13*37
...
student@ubuntu:~/piscine-go/test$ ./test 0
$ go run . 0
student@ubuntu:~/piscine-go/test$ ./test 1
$ go run . 1
1
student@ubuntu:~/piscine-go/test$
$
```
The subject states that only **positive integer** will be tested, however, 0 and 1 are not primes.
@ -59,24 +58,23 @@ Write a program that takes a positive `int` and displays its prime factors, foll
### Usage
```console
student@ubuntu:~/piscine-go/test$ go build
student@ubuntu:~/piscine-go/test$ ./test 225225
$ go run . 225225
3*3*5*5*7*11*13
student@ubuntu:~/piscine-go/test$ ./test 8333325
$ go run . 8333325
3*3*5*5*7*11*13*37
student@ubuntu:~/piscine-go/test$ ./test 9539
$ go run . 9539
9539
student@ubuntu:~/piscine-go/test$ ./test 804577
$ go run . 804577
804577
student@ubuntu:~/piscine-go/test$ ./test 42
$ go run . 42
2*3*7
student@ubuntu:~/piscine-go/test$ ./test a
$ go run . a
student@ubuntu:~/piscine-go/test$ ./test 0
$ go run . 0
student@ubuntu:~/piscine-go/test$ ./test 1
$ go run . 1
1
student@ubuntu:~/piscine-go/test$
$
```
---

View File

@ -33,8 +33,7 @@ func main() {
And its output :
```console
student@ubuntu:~/abort/test$ go build
student@ubuntu:~/abort/test$ ./test
$ go run .
5
student@ubuntu:~/abort/test$
$
```

View File

@ -32,8 +32,7 @@ func main() {
And its output :
```console
student@ubuntu:~/activebits/test$ go build
student@ubuntu:~/activebits/test$ ./test
$ go run .
3
student@ubuntu:~/activebits/test$
$
```

View File

@ -26,9 +26,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/adding/test$ cargo run
$ cargo run
-5
2261
305696
student@ubuntu:~/adding/test$
$
```

View File

@ -50,10 +50,10 @@ fn main() {
And its output
```console
student@ubuntu:~/adding_twice/test$ cargo run
$ cargo run
The value is 27
The value is 47
The value is 67
The value is -57
student@ubuntu:~/adding_twice/test$
$
```

View File

@ -60,8 +60,7 @@ func main() {
An its output:
```console
student@ubuntu:~/addlinkednumbers/test$ go build
student@ubuntu:~/addlinkednumbers/test$ ./main
$ go run .
9 -> 0 -> 7
student@ubuntu:~/addlinkednumbers/test$
$
```

View File

@ -9,18 +9,17 @@ Write a program that takes a positive integer as argument and displays the sum o
### Usage
```console
student@ubuntu:~/addprimesum/test$ go build
student@ubuntu:~/addprimesum/test$ ./test 5
$ go run . 5
10
student@ubuntu:~/addprimesum/test$ ./test 7
$ go run . 7
17
student@ubuntu:~/addprimesum/test$ ./test -2
$ go run . -2
0
student@ubuntu:~/addprimesum/test$ ./test 0
$ go run . 0
0
student@ubuntu:~/addprimesum/test$ ./test
$ go run .
0
student@ubuntu:~/addprimesum/test$ ./test 5 7
$ go run . 5 7
0
student@ubuntu:~/addprimesum/test$
$
```

View File

@ -36,8 +36,7 @@ func main() {
And its output :
```console
student@ubuntu:~/advancedsortwordarr/test$ go build
student@ubuntu:~/advancedsortwordarr/test$ ./test
$ go run .
[1 2 3 A B C a b c]
student@ubuntu:~/advancedsortwordarr/test$
$
```

View File

@ -37,8 +37,7 @@ func main() {
And its output :
```console
student@ubuntu:~/alphacount/test$ go build
student@ubuntu:~/alphacount/test$ ./test
$ go run .
10
student@ubuntu:~/alphacount/test$
$
```

View File

@ -16,11 +16,10 @@ If the number of arguments is different from 1, the program displays nothing.
### Usage
```console
student@ubuntu:~/alphamirror$ go build
student@ubuntu:~/alphamirror$ ./alphamirror "abc"
$ go run . "abc"
zyx
student@ubuntu:~/alphamirror$ ./alphamirror "My horse is Amazing." | cat -e
$ go run . "My horse is Amazing." | cat -e
Nb slihv rh Znzarmt.$
student@ubuntu:~/alphamirror$ ./alphamirror
student@ubuntu:~/alphamirror$
$ go run .
$
```

View File

@ -41,9 +41,8 @@ func main() {
And its output :
```console
student@ubuntu:~/any/test$ go build
student@ubuntu:~/any/test$ ./test
$ go run .
false
true
student@ubuntu:~/any/test$
$
```

View File

@ -39,9 +39,8 @@ func main() {
And its output :
```console
student@ubuntu:~/appendrange/test$ go build
student@ubuntu:~/appendrange/test$ ./test
$ go run .
[5 6 7 8 9]
[]
student@ubuntu:~/appendrange/test$
$
```

View File

@ -35,7 +35,7 @@ fn main() {
And its output
```console
student@ubuntu:~/arrange_it/test$ cargo run
$ cargo run
"This is a Test"
student@ubuntu:~/arrange_it/test$
$
```

View File

@ -54,10 +54,10 @@ fn main() {
And its output:
```console
student@ubuntu:~/arrays/test$ cargo run
$ cargo run
The Sum of the elements in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = 55
The Sum of the elements in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = 55
The Sum of the elements in [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] = 50
Array size 32 with only 10's in it [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
student@ubuntu:~/arrays/test$
$
```

View File

@ -68,8 +68,7 @@ etc
### Usage
```console
student@ubuntu:~/ascii-art$ go build
student@ubuntu:~/ascii-art$ ./ascii-art "hello"
$ go run . "hello"
_ _ _
| | | | | |
| |__ ___ | | | | ___
@ -78,7 +77,7 @@ student@ubuntu:~/ascii-art$ ./ascii-art "hello"
|_| |_| \___| |_| |_| \___/
student@ubuntu:~/ascii-art$ ./ascii-art "HeLlO"
$ go run . "HeLlO"
_ _ _ _ ____
| | | | | | | | / __ \
| |__| | ___ | | | | | | | |
@ -87,7 +86,7 @@ student@ubuntu:~/ascii-art$ ./ascii-art "HeLlO"
|_| |_| \___| |______| |_| \____/
student@ubuntu:~/ascii-art$ ./ascii-art "Hello There"
$ go run . "Hello There"
_ _ _ _ _______ _
| | | | | | | | |__ __| | |
| |__| | ___ | | | | ___ | | | |__ ___ _ __ ___
@ -96,7 +95,7 @@ student@ubuntu:~/ascii-art$ ./ascii-art "Hello There"
|_| |_| \___| |_| |_| \___/ |_| |_| |_| \___| |_| \___|
student@ubuntu:~/ascii-art$ ./ascii-art "1Hello 2There"
$ go run . "1Hello 2There"
_ _ _ _ _______ _
_ | | | | | | | | ____ |__ __| | |
/ | | |__| | ___ | | | | ___ |___ \ | | | |__ ___ _ __ ___
@ -105,7 +104,7 @@ student@ubuntu:~/ascii-art$ ./ascii-art "1Hello 2There"
|_| |_| |_| \___| |_| |_| \___/ |_____| |_| |_| |_| \___| |_| \___|
student@ubuntu:~/ascii-art$ ./ascii-art "{Hello There}"
$ go run . "{Hello There}"
__ _ _ _ _ _______ _ __
/ / | | | | | | | | |__ __| | | \ \
| | | |__| | ___ | | | | ___ | | | |__ ___ _ __ ___ | |
@ -114,5 +113,5 @@ student@ubuntu:~/ascii-art$ ./ascii-art "{Hello There}"
| | |_| |_| \___| |_| |_| \___/ |_| |_| |_| \___| |_| \___| | |
\_\ /_/
student@ubuntu:~/ascii-art$
$
```

View File

@ -26,8 +26,7 @@ This project will help you learn about :
### Usage
```console
student@ubuntu:~/ascii-art$ go build
student@ubuntu:~/ascii-art$ ./ascii-art "hello" standard
$ go run . "hello" standard
_ _ _
| | | | | |
| |__ ___ | | | | ___
@ -37,7 +36,7 @@ student@ubuntu:~/ascii-art$ ./ascii-art "hello" standard
student@ubuntu:~/ascii-art$ ./ascii-art "Hello There!" shadow
$ go run . "Hello There!" shadow
_| _| _| _| _|_|_|_|_| _| _|
_| _| _|_| _| _| _|_| _| _|_|_| _|_| _| _|_| _|_| _|
@ -47,7 +46,7 @@ _| _| _|_|_| _| _| _|_| _| _| _| _|_|_| _| _
student@ubuntu:~/ascii-art$ ./ascii-art "Hello There!" thinkertoy
$ go run . "Hello There!" thinkertoy
o o o o o-O-o o
| | | | | | o
@ -57,5 +56,5 @@ o o o-o o o o-o o o o o-o o o-o
O
student@ubuntu:~/ascii-art$
$
```

View File

@ -32,8 +32,7 @@ This project will help you learn about :
### Usage
```console
|student@ubuntu:~/ascii-art$ go build |
|student@ubuntu:~/ascii-art$ ./ascii-art "hello" standard --align=center |
|$ go run . "hello" standard --align=center |
| _ _ _ |
| | | | | | | |
| | |__ ___ | | | | ___ |
@ -42,7 +41,7 @@ This project will help you learn about :
| |_| |_| \___| |_| |_| \___/ |
| |
| |
|student@ubuntu:~/ascii-art$ ./ascii-art "Hello There" standard --align=left |
|$ go run . "Hello There" standard --align=left |
| _ _ _ _ _______ _ |
|| | | | | | | | |__ __| | | |
|| |__| | ___ | | | | ___ | | | |__ ___ _ __ ___ |
@ -51,7 +50,7 @@ This project will help you learn about :
||_| |_| \___| |_| |_| \___/ |_| |_| |_| \___| |_| \___| |
| |
| |
|student@ubuntu:~/ascii-art$ ./ascii-art "hello" shadow --align=right |
|$ go run . "hello" shadow --align=right |
| |
| _| _| _| |
| _|_|_| _|_| _| _| _|_| |
@ -60,7 +59,7 @@ This project will help you learn about :
| _| _| _|_|_| _| _| _|_| |
| |
| |
|student@ubuntu:~/ascii-art$ ./ascii-art "how are you" shadow --align=justify |
|$ go run . "how are you" shadow --align=justify |
| |
|_| |
|_|_|_| _|_| _| _| _| _|_|_| _| _|_| _|_| _| _| _|_| _| _| |
@ -69,5 +68,5 @@ This project will help you learn about :
|_| _| _|_| _| _| _|_|_| _| _|_|_| _|_|_| _|_| _|_|_| |
| _| |
| _|_| |
|student@ubuntu:~/ascii-art$ |
|$ |
```

View File

@ -27,9 +27,8 @@ This project will help you learn about :
### Usage
```console
student@ubuntu:~/ascii-art$ go build
student@ubuntu:~/ascii-art$ ./ascii-art "hello" standard --output=banner.txt
student@ubuntu:~/ascii-art$ cat banner.txt
$ go run . "hello" standard --output=banner.txt
$ cat banner.txt
_ _ _
| | | | | |
| |__ ___ | | | | ___
@ -39,8 +38,8 @@ student@ubuntu:~/ascii-art$ cat banner.txt
student@ubuntu:~/ascii-art$ ./ascii-art "Hello There!" shadow --output=banner.txt
student@ubuntu:~/ascii-art$ cat banner.txt
$ go run . "Hello There!" shadow --output=banner.txt
$ cat banner.txt
_| _| _| _| _|_|_|_|_| _| _|
_| _| _|_| _| _| _|_| _| _|_|_| _|_| _| _|_| _|_| _|
@ -50,5 +49,5 @@ _| _| _|_|_| _| _| _|_| _| _| _| _|_|_| _| _
student@ubuntu:~/ascii-art$
$
```

View File

@ -30,8 +30,7 @@ This project will help you learn about :
### Usage
```console
student@ubuntu:~/ascii-art$ go build
student@ubuntu:~/ascii-art$ cat file.txt
$ cat file.txt
_ _ _
| | | | | |
| |__ ___ | | | | ___
@ -41,7 +40,7 @@ student@ubuntu:~/ascii-art$ cat file.txt
student@ubuntu:~/ascii-art$ ./ascii-art --reverse=file.txt
$ go run . --reverse=file.txt
hello
student@ubuntu:~/ascii-art$
$
```

View File

@ -45,8 +45,7 @@ func main() {
And its output :
```console
student@ubuntu:~/atoi/test$ go build
student@ubuntu:~/atoi/test$ ./test
$ go run .
12345
12345
0
@ -55,5 +54,5 @@ student@ubuntu:~/atoi/test$ ./test
-1234
0
0
student@ubuntu:~/atoi/test$
$
```

View File

@ -50,12 +50,11 @@ func main() {
And its output :
```console
student@ubuntu:~/atoibase/test$ go build
student@ubuntu:~/atoibase/test$ ./test
$ go run .
125
125
125
125
0
student@ubuntu:~/atoibase/test$
$
```

View File

@ -14,15 +14,15 @@ It will only be tested strings containing the characters 'C' and 'D'.
### Usage
```console
student@ubuntu:~/balancedstring$ go build
student@ubuntu:~/balancedstring$ ./balancedstring "CDCCDDCDCD"
$ go run . "CDCCDDCDCD"
4
student@ubuntu:~/balancedstring$ ./balancedstring "CDDDDCCCDC"
$ go run . "CDDDDCCCDC"
3
student@ubuntu:~/balancedstring$ ./balancedstring "DDDDCCCC"
$ go run . "DDDDCCCC"
1
student@ubuntu:~/balancedstring$ ./balancedstring "CDCCCDDCDD"
$ go run . "CDCCCDDCDD"
2
$
```
In first example "CDCCDDCDCD" can be split into "CD", "CCDD", "CD", "CD", each substring contains same number of 'C' and 'D'.

View File

@ -111,10 +111,10 @@ fn main() {
And its output:
```console
student@ubuntu:~/banner/test$ cargo run
$ cargo run
"0.5"
"0"
"invalid float literal"
"invalid float literal"
student@ubuntu:~/banner/test$
$
```

View File

@ -40,10 +40,9 @@ func main() {
And its output :
```console
student@ubuntu:~/basicatoi/test$ go build
student@ubuntu:~/basicatoi/test$ ./test
$ go run .
12345
12345
0
student@ubuntu:~/basicatoi/test$
$
```

View File

@ -41,11 +41,10 @@ func main() {
And its output :
```console
student@ubuntu:~/basicatoi2/test$ go build
student@ubuntu:~/basicatoi2/test$ ./test
$ go run .
12345
12345
0
0
student@ubuntu:~/basicatoi2/test$
$
```

View File

@ -33,8 +33,7 @@ func main() {
And its output :
```console
student@ubuntu:~/basicjoin/test$ go build
student@ubuntu:~/basicjoin/test$ ./test
$ go run .
Hello! How are you?
student@ubuntu:~/basicjoin/test$
$
```

View File

@ -38,7 +38,7 @@ fn main() {
And its output
```console
student@ubuntu:~/bigger/test$ cargo run
$ cargo run
The biggest of the elements in the HashMap is 334
student@ubuntu:~/bigger/test$
$
```

View File

@ -104,9 +104,9 @@ fn main() {
And its output
```console
student@ubuntu:~/blood_types/test$ cargo run
$ cargo run
recipients of O+ [AB+, O+, A+, B+]
donors of O+ [O+, O-]
donors of O+ can receive from A- false
student@ubuntu:~/blood_types/test$
$
```

View File

@ -84,9 +84,9 @@ fn main() {
And its output
```console
student@ubuntu:~/blood_types_s/test$ cargo run
$ cargo run
recipients of O+ [BloodType { antigen: AB, rh_factor: Positive }, BloodType { antigen: O, rh_factor: Positive }, BloodType { antigen: A, rh_factor: Positive }, BloodType { antigen: B, rh_factor: Positive }]
donors of O+ [BloodType { antigen: O, rh_factor: Positive }, BloodType { antigen: O, rh_factor: Negative }]
donors of O+ can receive from BloodType { antigen: O, rh_factor: Positive } true
student@ubuntu:~/blood_types_s/test$
$
```

View File

@ -40,9 +40,8 @@ func main() {
### Usage
```console
student@ubuntu:~/boolean$ go build
student@ubuntu:~/boolean$ ./boolean "not" "odd"
$ go run . "not" "odd"
I have an even number of arguments
student@ubuntu:~/boolean$ ./boolean "not even"
$ go run . "not even"
I have an odd number of arguments
```

View File

@ -73,7 +73,7 @@ fn main() {
And its output
```console
student@ubuntu:~/border_cross/test$ cargo run
$ cargo run
["Model 3", "Ranger"]
student@ubuntu:~/border_cross/test$
$
```

View File

@ -33,9 +33,9 @@ fn main() {
And its output:
```rust
student@ubuntu:~/borrow/test$ cargo run
```console
$ cargo run
str_len("hello") = 5
str_len("camelCase") = 9
student@ubuntu:~/borrow/test$
$
```

View File

@ -82,10 +82,10 @@ fn main() {
And its output:
```console
student@ubuntu:~/borrow_box/test$ cargo run
$ cargo run
("Same score! tied", 0)
("Same score! tied", 2)
("Joao", 3)
"game deleted: id -> 0"
student@ubuntu:~/borrow_box/test$
$
```

View File

@ -54,7 +54,7 @@ fn main() {
And its output
```console
student@ubuntu:~/borrow_me_the_reference/test$ cargo run
$ cargo run
("borrow", ["✔", "✔", "✘", "✔"], 75)
student@ubuntu:~/borrow_me_the_reference/test$
$
```

View File

@ -50,10 +50,10 @@ fn main() {
And its output:
```console
student@ubuntu:~/box_it/test$ cargo run
$ cargo run
Box value : [5500, 8900, 32]
size occupied in the stack : 8 bytes
value : [5500, 8900, 32]
size occupied in the stack : 24 bytes
student@ubuntu:~/box_it/test$
$
```

View File

@ -72,9 +72,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/box_recursion/test$ cargo run
$ cargo run
WorkEnvironment { grade: Some(Worker { worker_type: "Normal Worker", worker_name: "Alice", next_worker: Some(Worker { worker_type: "Normal Worker", worker_name: "Ana", next_worker: Some(Worker { worker_type: "Manager", worker_name: "Monica", next_worker: Some(Worker { worker_type: "CEO", worker_name: "Marie", next_worker: None }) }) }) }) }
Some(("Alice", "Normal Worker"))
WorkEnvironment { grade: None }
student@ubuntu:~/box_recursion/test$
$
```

View File

@ -165,9 +165,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/boxing_todo/test$ cargo run
$ cargo run
TodoList { title: "TODO LIST FOR PISCINE RUST", tasks: [Task { id: 0, description: "do this", level: 0 }, Task { id: 1, description: "do that", level: 5 }] }
Todo List parse failed: None
Fail to parses todo Some(Malformed(UnexpectedCharacter { ch: ',', line: 2, column: 18 }))
student@ubuntu:~/boxing_todo/test$
$
```

View File

@ -13,13 +13,13 @@ If there is no argument, the program must print nothing.
### Usage
```console
student@ubuntu:~/brackets$ ./brackets '(johndoe)' | cat -e
$ go run . '(johndoe)' | cat -e
OK$
student@ubuntu:~/brackets$ ./brackets '([)]' | cat -e
$ go run . '([)]' | cat -e
Error$
student@ubuntu:~/brackets$ ./brackets '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e
$ go run . '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e
OK$
OK$
student@ubuntu:~/brackets$ ./brackets
student@ubuntu:~/brackets$
$ go run .
$
```

View File

@ -13,13 +13,13 @@ If there is no argument, the program must print nothing.
### Usage
```console
student@ubuntu:~/brackets_matching/brackets$ ./brackets '(johndoe)' | cat -e
$ go run . '(johndoe)' | cat -e
OK$
student@ubuntu:~/brackets_matching/brackets$ ./brackets '([)]' | cat -e
$ go run . '([)]' | cat -e
Error$
student@ubuntu:~/brackets_matching/brackets$ ./brackets '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e
$ go run . '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e
OK$
OK$
student@ubuntu:~/brackets_matching/brackets$ ./brackets
student@ubuntu:~/brackets_matching/brackets$
$ go run .
$
```

View File

@ -22,13 +22,12 @@ Any other character is a comment.
### Usage
```console
student@ubuntu:~/brainfuck$ go build
student@ubuntu:~/brainfuck$ ./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
$ go run . "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
Hello World!$
student@ubuntu:~/brainfuck$ ./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
$ go run . "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
Hi$
student@ubuntu:~/brainfuck$ ./brainfuck "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++." | cat -e
$ go run . "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++." | cat -e
abc$
student@ubuntu:~/brainfuck$ ./brainfuck
student@ubuntu:~/brainfuck$
$ go run .
$
```

View File

@ -36,11 +36,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeapplybylevel/test$ go build
student@ubuntu:~/btreeapplybylevel/test$ ./test
$ go run .
4
1
7
5
student@ubuntu:~/btreeapplybylevel/test$
$
```

View File

@ -37,11 +37,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeapplyinorder/test$ go build
student@ubuntu:~/btreeapplyinorder/test$ ./test
$ go run .
1
4
5
7
student@ubuntu:~/btreeapplyinorder/test$
$
```

View File

@ -37,11 +37,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeapplypostorder/test$ go build
student@ubuntu:~/btreeapplypostorder/test$ ./test
$ go run .
1
5
7
4
student@ubuntu:~/btreeapplypostorder/test$
$
```

View File

@ -37,11 +37,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeapplypreorder/test$ go build
student@ubuntu:~/btreeapplypreorder/test$ ./test
$ go run .
4
1
7
5
student@ubuntu:~/btreeapplypreorder/test$
$
```

View File

@ -43,8 +43,7 @@ func main() {
And its output :
```console
student@ubuntu:~/btreedeletenode/test$ go build
student@ubuntu:~/btreedeletenode/test$ ./test
$ go run .
Before delete:
1
4
@ -54,5 +53,5 @@ After delete:
1
5
7
student@ubuntu:~/btreedeletenode/test$
$
```

View File

@ -47,11 +47,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeinsertdata$ go build
student@ubuntu:~/btreeinsertdata$ ./btreeinsertdata
$ go run .
1
4
5
7
student@ubuntu:~/btreeinsertdata$
$
```

View File

@ -36,8 +36,7 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeisbinary/test$ go build
student@ubuntu:~/btreeisbinary/test$ ./test
$ go run .
true
student@ubuntu:~/btreeisbinary/test$
$
```

View File

@ -37,8 +37,7 @@ func main() {
And its output :
```console
student@ubuntu:~/btreelevelcount/test$ go build
student@ubuntu:~/btreelevelcount/test$ ./test
$ go run .
3
student@ubuntu:~/btreelevelcount/test$
$
```

View File

@ -38,8 +38,7 @@ func main() {
And its output :
```console
student@ubuntu:~/btreemax/test$ go build
student@ubuntu:~/btreemax/test$ ./test
$ go run .
7
student@ubuntu:~/btreemax/test$
$
```

View File

@ -38,8 +38,7 @@ func main() {
And its output :
```console
student@ubuntu:~/btreemin/test$ go build
student@ubuntu:~/btreemin/test$ ./test
$ go run .
1
student@ubuntu:~/btreemin/test$
$
```

View File

@ -38,10 +38,9 @@ func main() {
And its output :
```console
student@ubuntu:~/btreeprintroot/printroot$ go build
student@ubuntu:~/btreeprintroot/printroot$ ./printroot
$ go run .
who
are
you
student@ubuntu:~/btreeprintroot/test$
$
```

View File

@ -63,11 +63,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreesearchitem/test$ go build
student@ubuntu:~/btreesearchitem/test$ ./test
$ go run .
Item selected -> 7
Parent of selected item -> 4
Left child of selected item -> 5
Right child of selected item -> nil
student@ubuntu:~/btreesearchitem/test$
$
```

View File

@ -39,11 +39,10 @@ func main() {
And its output :
```console
student@ubuntu:~/btreetransplant/test$ go build
student@ubuntu:~/btreetransplant/test$ ./test
$ go run .
3
4
5
7
student@ubuntu:~/btreetransplant/test$
$
```

View File

@ -34,8 +34,7 @@ func main() {
And its output :
```console
student@ubuntu:~/capitalize/test$ go build
student@ubuntu:~/capitalize/test$ ./test
$ go run .
Hello! How Are You? How+Are+Things+4you?
student@ubuntu:~/capitalize/test$
$
```

View File

@ -38,9 +38,9 @@ fn main() {
And its output
```consoole
student@ubuntu:~/capitalizing/test$ cargo run
$ cargo run
Joe is missing
Jill Is Leaving A
HEllO thERE
student@ubuntu:~/capitalizing/test$
$
```

View File

@ -82,7 +82,7 @@ fn main() {
And its output
```console
student@ubuntu:~/card_deck/test$ cargo run
$ cargo run
Your card is Card { suit: Club, rank: Ace }
student@ubuntu:~/card_deck/test$
$
```

View File

@ -9,26 +9,25 @@ Write a program that behaves like a simplified `cat` command.
- If the program is called without arguments it should take the standard input (stdin) and print it back on the standard output (stdout).
```console
student@ubuntu:~/cat$ echo '"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing' > quest8.txt
student@ubuntu:~/cat$ cat <<EOF> quest8T.txt
$ echo '"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing' > quest8.txt
$ cat <<EOF> quest8T.txt
"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
EOF
student@ubuntu:~/cat$ go build
student@ubuntu:~/cat$ ./cat abc
$ go run . abc
ERROR: abc: No such file or directory
student@ubuntu:~/cat$ ./cat quest8.txt
$ go run . quest8.txt
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
student@ubuntu:~/cat$ ./cat quest8.txt abc
$ go run . quest8.txt abc
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
ERROR: abc: No such file or directory
student@ubuntu:~/cat$ cat quest8.txt | ./cat
$ cat quest8.txt | ./cat
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
student@ubuntu:~/cat$ ./cat
$ go run .
Hello
Hello
^C
student@ubuntu:~/cat$ ./cat quest8.txt quest8T.txt
$ go run . quest8.txt quest8T.txt
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
student@ubuntu:~/cat$
$
```

View File

@ -54,7 +54,7 @@ func main() {
Its output:
```console
$ go build
$ ./main
$ go run .
1 -> 3 -> 5 -> 2 -> 4
$
```

View File

@ -54,8 +54,8 @@ fn main() {
And its expected output
```console
student@ubuntu:~/changes/test$ cargo run
$ cargo run
brightness = 0
new brightness = 200
student@ubuntu:~/changes/test$
$
```

View File

@ -33,12 +33,11 @@ func main() {
And its output :
```console
student@ubuntu:~/chunk/test$ go build
student@ubuntu:~/chunk/test$ ./test
$ go run .
[]
[[0 1 2] [3 4 5] [6 7]]
[[0 1 2 3 4] [5 6 7]]
[[0 1 2 3] [4 5 6 7]]
student@ubuntu:~/chunk/test$
$
```

View File

@ -48,9 +48,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/cipher/test$ cargo run
$ cargo run
Some(Ok(true))
Some(Err(CipherError { validation: false, expected: "1Svool 2dliow!" }))
None
student@ubuntu:~/cipher/test$
$
```

View File

@ -93,11 +93,11 @@ fn main() {
And its output
```console
student@ubuntu:~/circle/test$ cargo run
$ cargo run
circle = Circle { center: Point { x: 500.0, y: 500.0 }, radius: 150.0 } area = 70685.83470577035
circle = Circle { center: Point { x: 500.0, y: 500.0 }, radius: 150.0 } diameter = 300
circle1 = Circle { center: Point { x: 80.0, y: 115.0 }, radius: 30.0 } diameter = 60
circle and circle1 intersect = false
distance between Point { x: 1.0, y: 1.0 } and Point { x: 0.0, y: 0.0 } is 1.4142135623730951
student@ubuntu:~/circle/test$
$
```

View File

@ -11,7 +11,7 @@ A line is a sequence of characters preceding the [end of line](https://en.wikipe
### Usage
```console
student@ubuntu:~/cl-camp2/test$ cat -e r
$ cat -e r
R$
student@ubuntu:~/cl-camp2/test$
$
```

View File

@ -17,8 +17,8 @@ Create a file `myfamily.sh`, which will show a subject's family (key: relatives)
### Usage
```console
student@ubuntu:~/cl-camp4/test$ export HERO_ID=1
student@ubuntu:~/cl-camp4/test$ ./myfamily.sh
$ export HERO_ID=1
$ ./myfamily.sh
Marlo Chandler-Jones (wife); Polly (aunt); Mrs. Chandler (mother-in-law); Keith Chandler, Ray Chandler, three unidentified others (brothers-in-law); unidentified father (deceased); Jackie Shorr (alleged mother; unconfirmed)
student@ubuntu:~/cl-camp4/test$
$
```

View File

@ -13,11 +13,11 @@ That command will only show the name of the files without the `.sh`.
### Usage
```console
student@ubuntu:~/cl-camp5/test$ ./lookagain.sh | cat -e
$ ./lookagain.sh | cat -e
file1$
file2$
file3$
student@ubuntu:~/cl-camp5/test$
$
```
### Hint

View File

@ -9,7 +9,7 @@ Create a file `countfiles.sh`, which will print the number **(and only the numbe
### Usage
```console
student@ubuntu:~/cl-camp6/test$ ./countfiles.sh | cat -e
$ ./countfiles.sh | cat -e
12$
student@ubuntu:~/cl-camp6/test$
$
```

View File

@ -9,7 +9,7 @@ Create a file `"\?$*'ChouMi'*$?\"` that will contain "01" and **nothing else**.
### Usage
```console
student@ubuntu:~/cl-camp7/test$ ls | cat -e
$ ls | cat -e
"\?$*'ChouMi'*$?\"$
student@ubuntu:~/cl-camp7/test$
$
```

View File

@ -17,13 +17,12 @@ program displays nothing.
### Usage :
```console
student@ubuntu:~/cleanstr$ go build
student@ubuntu:~/cleanstr$ ./cleanstr "you see it's easy to display the same thing" | cat -e
$ go run . "you see it's easy to display the same thing" | cat -e
you see it's easy to display the same thing$
student@ubuntu:~/cleanstr$ ./cleanstr " only it's harder "
$ go run . " only it's harder "
only it's harder$
student@ubuntu:~/cleanstr$ ./cleanstr " how funny" "Did you hear Mathilde ?"
$ go run . " how funny" "Did you hear Mathilde ?"
$
$ go run . ""
$
student@ubuntu:~/cleanstr$ ./cleanstr ""
student@ubuntu:~/cleanstr$
```

View File

@ -35,7 +35,7 @@ fn main() {
And its output:
```console
student@ubuntu:~/closures/test$ cargo run
$ cargo run
All elements in [4, 16, 36, ..., 10000], len = 50
student@ubuntu:~/closures/test$
$
```

View File

@ -35,8 +35,7 @@ func main() {
And its output :
```console
student@ubuntu:~/{{ROOT}}/test$ go build
student@ubuntu:~/{{ROOT}}/test$ ./test
$ go run .
9
student@ubuntu:~/{{ROOT}}/test$
$
```

View File

@ -32,8 +32,8 @@ fn main() {
And its output:
```console
student@ubuntu:~/collect/test$ cargo run
$ cargo run
[1, 2, 3, 4, 5, 7]
[1, 2, 3, 4, 5, 7]
student@ubuntu:~/collect/test$
$
```

View File

@ -11,10 +11,9 @@ Write a program `comcheck` that displays on the standard output `Alert!!!` follo
### Usage
```console
student@ubuntu:~/comcheck$ go build
student@ubuntu:~/comcheck$ ./comcheck "I" "Will" "Enter" "the" "galaxy"
$ go run . "I" "Will" "Enter" "the" "galaxy"
Alert!!!
student@ubuntu:~/comcheck$ ./comcheck "galaxy 01" "do" "you" "hear" "me"
$ go run . "galaxy 01" "do" "you" "hear" "me"
Alert!!!
student@ubuntu:~/comcheck$
$
```

View File

@ -51,8 +51,8 @@ fn main() {
And its output:
```console
student@ubuntu:~/commits_stats/test$ cargo run
$ cargo run
{"2020-W44": 5, "2020-W36": 1, "2020-W31": 1, ... ,"2020-W45": 4, "2020-W46": 4}
{"homembaixinho": 2, "mwenzkowski": 3, ... ,"tamirzb": 1, "paul-ri": 2, "RPigott": 1}
student@ubuntu:~/commits_stats/test$
$
```

View File

@ -53,8 +53,7 @@ func main() {
And its output :
```console
student@ubuntu:~/compact/test$ go build
student@ubuntu:~/compact/test$ ./test
$ go run .
a
b
@ -65,5 +64,5 @@ Size after compacting: 3
a
b
c
student@ubuntu:~/compact/test$
$
```

View File

@ -34,10 +34,9 @@ func main() {
And its output :
```console
student@ubuntu:~/compare/test$ go build
student@ubuntu:~/compare/test$ ./test
$ go run .
0
-1
1
student@ubuntu:~/compare/test$
$
```

View File

@ -33,8 +33,7 @@ func main() {
And its output :
```console
student@ubuntu:~/concat/test$ go build
student@ubuntu:~/concat/test$ ./test
$ go run .
Hello! How are you?
student@ubuntu:~/concat/test$
$
```

View File

@ -34,11 +34,10 @@ func main() {
And its output :
```console
student@ubuntu:~/concatparams/test$ go build
student@ubuntu:~/concatparams/test$ ./test
$ go run .
Hello
how
are
you?
student@ubuntu:~/concatparams/test$
$
```

View File

@ -37,8 +37,7 @@ func main() {
And its output :
```console
student@ubuntu:~/convertbase/test$ go build
student@ubuntu:~/convertbase/test$ ./test
$ go run .
43
student@ubuntu:~/convertbase/test$
$
```

View File

@ -60,9 +60,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/copy/test$ cargo run
$ cargo run
(0, 1.0, inf)
("1 2 4 5 6", "2.718281828459045 7.38905609893065 54.598150033144236 148.4131591025766 403.4287934927351")
([1, 2, 4, 5], [0.0, 0.6931471805599453, 1.3862943611198906, 1.6094379124341003])
student@ubuntu:~/copy/test$
$
```

View File

@ -16,9 +16,10 @@ Input will be given as 6 arguments, your output should be displayed as standard
In the output put '\n' at the end.
Input: `./main **a** **b** **c** **d** **e** **f**`
Input: `go run . **a** **b** **c** **d** **e** **f**`
```console
$ ./main 12 11 13 20 4 6
$ go run . 12 11 13 20 4 6
102
$
```

View File

@ -7,8 +7,7 @@ Write a program that displays all digits in descending order, followed by a newl
### Usage
```console
student@ubuntu:~/countdown/test$ go build
student@ubuntu:~/countdown/test$ ./test
$ go run .
9876543210
student@ubuntu:~/countdown/test$
$
```

View File

@ -37,9 +37,8 @@ func main() {
And its output :
```console
student@ubuntu:~/countif/test$ go build
student@ubuntu:~/countif/test$ ./test
$ go run .
0
2
student@ubuntu:~/countif/test$
$
```

View File

@ -42,9 +42,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/counting_words/test$ cargo run
$ cargo run
{"hello": 1, "world": 1}
{"and": 2, "human": 1, "universe": 2, "the": 2, "i\'m": 1, "about": 1, "einstein": 1, "are": 1, "infinite": 1, "sure": 1, "albert": 1, "two": 1, "things": 1, "not": 1, "stupidity": 1}
{"batman": 3, "stop": 2}
student@ubuntu:~/counting_words/test$
$
```

View File

@ -38,8 +38,7 @@ func main() {
And its output :
```console
student@ubuntu:~/createelem/test$ go build
student@ubuntu:~/createelem/test$ ./test
$ go run .
&{1234}
student@ubuntu:~/createelem/test$
$
```

View File

@ -27,8 +27,8 @@ fn main() {
And its output:
```console
student@ubuntu:~/delete_prefix/test$ cargo run
$ cargo run
Some("cdefghijklmnop")
None
student@ubuntu:~/delete_prefix/test$
$
```

View File

@ -43,8 +43,8 @@ fn main() {
And its output:
```console
student@ubuntu:~/diamond_creation/test$ cargo run
$ cargo run
["A"]
[" A ", " B B ", "C C", " B B ", " A "]
student@ubuntu:~/diamond_creation/test$
$
```

View File

@ -74,11 +74,11 @@ fn main() {
And its output:
```console
student@ubuntu:~/display_table/test$ cargo run
$ cargo run
| Model | Piece N° | In Stock | Description |
|---------+-------------+-----------+-------------|
| model 1 | 43-EWQE304 | 30 | Piece for x |
| model 2 | 98-QCVX5433 | 100000000 | - |
| model y | 78-NMNH | 60 | nothing |
student@ubuntu:~/display_table/test$
$
```

View File

@ -9,12 +9,11 @@ If the number of arguments is not 1, the program displays an `a` followed by a n
### Usage
```console
student@ubuntu:~/displaya/test$ go build
student@ubuntu:~/displaya/test$ ./test "abc"
$ go run . "abc"
a
student@ubuntu:~/displaya/test$ ./test "bcvbvA"
$ go run . "bcvbvA"
a
student@ubuntu:~/displaya/test$ ./test "nbv"
$ go run . "nbv"
a
student@ubuntu:~/displaya/test$
$
```

View File

@ -7,8 +7,7 @@ Write a program that displays the alphabet, with even letters in uppercase, and
### Usage
```console
student@ubuntu:~/displayalpham$ go build
student@ubuntu:~/displayalpham$ ./displayalpham | cat -e
$ go run . | cat -e
aBcDeFgHiJkLmNoPqRsTuVwXyZ$
student@ubuntu:~/displayalpham$
$
```

View File

@ -7,8 +7,7 @@ Write a program that displays the alphabet in reverse, with even letters in uppe
### Usage
```console
student@ubuntu:~/displayalrevm$ go build
student@ubuntu:~/displayalrevm$ ./displayalrevm | cat -e
$ go run . | cat -e
zYxWvUtSrQpOnMlKjIhGfEdCbA$
student@ubuntu:~/displayalrevm$
$
```

View File

@ -7,13 +7,12 @@ Write a program that displays, on the standard output, the content of a file giv
### Usage :
```console
student@ubuntu:~/displayfile$ go build
student@ubuntu:~/displayfile$ ./displayfile
$ go run .
File name missing
student@ubuntu:~/displayfile$ echo "Almost there!!" > quest8.txt
student@ubuntu:~/displayfile$ ./displayfile quest8.txt main.go
$ echo "Almost there!!" > quest8.txt
$ go run . quest8.txt main.go
Too many arguments
student@ubuntu:~/displayfile$ ./displayfile quest8.txt
$ go run . quest8.txt
Almost there!!
student@ubuntu:~/displayfile$
$
```

View File

@ -7,11 +7,10 @@ Write a program that displays its first argument, if there is one.
### Usage
```console
student@ubuntu:~/displayfirstparam/test$ go build
student@ubuntu:~/displayfirstparam/test$ ./test hello there
$ go run . hello there
hello
student@ubuntu:~/displayfirstparam/test$ ./test "hello there" how are you
$ go run . "hello there" how are you
hello there
student@ubuntu:~/displayfirstparam/test$ ./test
student@ubuntu:~/displayfirstparam/test$
$ go run .
$
```

View File

@ -7,13 +7,12 @@ Write a program that displays its last argument, if there is one.
### Usage
```console
student@ubuntu:~/displaylastparam/test$ go build
student@ubuntu:~/displaylastparam/test$ ./test hello there
$ go run . hello there
there
student@ubuntu:~/displaylastparam/test$ ./test "hello there" how are you
$ go run . "hello there" how are you
you
student@ubuntu:~/displaylastparam/test$ ./test "hello there"
$ go run . "hello there"
hello there
student@ubuntu:~/displaylastparam/test$ ./test
student@ubuntu:~/displaylastparam/test$
$ go run .
$
```

View File

@ -9,12 +9,11 @@ If the number of arguments is not 1, the program displays an `z` followed by a n
### Usage
```console
student@ubuntu:~/displayz/test$ go build
student@ubuntu:~/displayz/test$ ./test "xyz"
$ go run . "xyz"
z
student@ubuntu:~/displayz/test$ ./test "bcvbvZ"
$ go run . "bcvbvZ"
z
student@ubuntu:~/displayz/test$ ./test "nbv"
$ go run . "nbv"
z
student@ubuntu:~/displayz/test$ ./test
$ go run .
```

View File

@ -41,7 +41,7 @@ fn main() {
And its output
```console
student@ubuntu:~/division_and_remainder/test$ cargo run
$ cargo run
9/4: division = 2, remainder = 1
student@ubuntu:~/division_and_remainder/test$
$
```

View File

@ -42,9 +42,8 @@ func main() {
And its output :
```console
student@ubuntu:~/divmod/test$ go build
student@ubuntu:~/divmod/test$ ./test
$ go run .
6
1
student@ubuntu:~/divmod/test$
$
```

View File

@ -17,25 +17,24 @@ The program has to handle the modulo and division operations by 0 as shown on th
### Usage
```console
student@ubuntu:~/doop/test$ go build doop.go
student@ubuntu:~/doop/test$ ./doop
student@ubuntu:~/doop/test$ ./doop 1 + 1 | cat -e
$ go run .
$ go run . 1 + 1 | cat -e
2$
student@ubuntu:~/doop/test$ ./doop hello + 1
student@ubuntu:~/doop/test$ ./doop 1 p 1
student@ubuntu:~/doop/test$ ./doop 1 / 0 | cat -e
$ go run . hello + 1
$ go run . 1 p 1
$ go run . 1 / 0 | cat -e
No division by 0$
student@ubuntu:~/doop/test$ ./doop 1 % 0 | cat -e
$ go run . 1 % 0 | cat -e
No modulo by 0$
student@ubuntu:~/doop/test$ ./doop 9223372036854775807 + 1
$ go run . 9223372036854775807 + 1
0
student@ubuntu:~/doop/test$ ./doop -9223372036854775809 - 3
$ go run . -9223372036854775809 - 3
0
student@ubuntu:~/doop/test$ ./doop 9223372036854775807 "*" 3
$ go run . 9223372036854775807 "*" 3
0
student@ubuntu:~/doop/test$ ./doop 1 "*" 1
$ go run . 1 "*" 1
1
student@ubuntu:~/doop/test$ ./doop 1 "*" -1
$ go run . 1 "*" -1
-1
student@ubuntu:~/doop/test$
$
```

View File

@ -38,8 +38,8 @@ fn main() {
And its output
```console
student@ubuntu:~/doubtful/test$ cargo run
$ cargo run
Before changing the string: Hello
After changing the string: Hello?
student@ubuntu:~/doubtful/test$
$
```

View File

@ -105,9 +105,9 @@ fn main() {
And its output:
```console
student@ubuntu:~/drop_the_thread/test$ cargo run
$ cargo run
(true, 0, Cell { value: 1 })
(true, 1, Cell { value: 2 })
(false, 2, Cell { value: 2 }, 1)
student@ubuntu:~/drop_the_thread/test$
$
```

View File

@ -42,8 +42,8 @@ fn main() {
And its output
```console
student@ubuntu:~/easy_traits/test$ cargo run
$ cargo run
hello world
["one", "two", "three"]
student@ubuntu:~/easy_traits/test$
$
```

Some files were not shown because too many files have changed in this diff Show More