mirror of https://github.com/01-edu/public.git
Simplify prompt, execution of Go programs, fix typos
This commit is contained in:
parent
5cb1e96818
commit
46f4ddc49e
|
@ -13,19 +13,18 @@ Example: [fprime](https://github.com/01-edu/public/blob/master/subjects/fprime.e
|
||||||
The exceptional cases in the `usage` part.
|
The exceptional cases in the `usage` part.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/piscine-go/test$ go build
|
$ go run . 225225
|
||||||
student@ubuntu:~/piscine-go/test$ ./test 225225
|
|
||||||
3*3*5*5*7*11*13
|
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
|
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
|
1
|
||||||
student@ubuntu:~/piscine-go/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
The subject states that only **positive integer** will be tested, however, 0 and 1 are not primes.
|
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
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/piscine-go/test$ go build
|
$ go run . 225225
|
||||||
student@ubuntu:~/piscine-go/test$ ./test 225225
|
|
||||||
3*3*5*5*7*11*13
|
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
|
3*3*5*5*7*11*13*37
|
||||||
student@ubuntu:~/piscine-go/test$ ./test 9539
|
$ go run . 9539
|
||||||
9539
|
9539
|
||||||
student@ubuntu:~/piscine-go/test$ ./test 804577
|
$ go run . 804577
|
||||||
804577
|
804577
|
||||||
student@ubuntu:~/piscine-go/test$ ./test 42
|
$ go run . 42
|
||||||
2*3*7
|
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
|
1
|
||||||
student@ubuntu:~/piscine-go/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -33,8 +33,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/abort/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/abort/test$ ./test
|
|
||||||
5
|
5
|
||||||
student@ubuntu:~/abort/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -32,8 +32,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/activebits/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/activebits/test$ ./test
|
|
||||||
3
|
3
|
||||||
student@ubuntu:~/activebits/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -26,9 +26,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/adding/test$ cargo run
|
$ cargo run
|
||||||
-5
|
-5
|
||||||
2261
|
2261
|
||||||
305696
|
305696
|
||||||
student@ubuntu:~/adding/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -50,10 +50,10 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/adding_twice/test$ cargo run
|
$ cargo run
|
||||||
The value is 27
|
The value is 27
|
||||||
The value is 47
|
The value is 47
|
||||||
The value is 67
|
The value is 67
|
||||||
The value is -57
|
The value is -57
|
||||||
student@ubuntu:~/adding_twice/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -60,8 +60,7 @@ func main() {
|
||||||
An its output:
|
An its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/addlinkednumbers/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/addlinkednumbers/test$ ./main
|
|
||||||
9 -> 0 -> 7
|
9 -> 0 -> 7
|
||||||
student@ubuntu:~/addlinkednumbers/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,18 +9,17 @@ Write a program that takes a positive integer as argument and displays the sum o
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/addprimesum/test$ go build
|
$ go run . 5
|
||||||
student@ubuntu:~/addprimesum/test$ ./test 5
|
|
||||||
10
|
10
|
||||||
student@ubuntu:~/addprimesum/test$ ./test 7
|
$ go run . 7
|
||||||
17
|
17
|
||||||
student@ubuntu:~/addprimesum/test$ ./test -2
|
$ go run . -2
|
||||||
0
|
0
|
||||||
student@ubuntu:~/addprimesum/test$ ./test 0
|
$ go run . 0
|
||||||
0
|
0
|
||||||
student@ubuntu:~/addprimesum/test$ ./test
|
$ go run .
|
||||||
0
|
0
|
||||||
student@ubuntu:~/addprimesum/test$ ./test 5 7
|
$ go run . 5 7
|
||||||
0
|
0
|
||||||
student@ubuntu:~/addprimesum/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -36,8 +36,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/advancedsortwordarr/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/advancedsortwordarr/test$ ./test
|
|
||||||
[1 2 3 A B C a b c]
|
[1 2 3 A B C a b c]
|
||||||
student@ubuntu:~/advancedsortwordarr/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,8 +37,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/alphacount/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/alphacount/test$ ./test
|
|
||||||
10
|
10
|
||||||
student@ubuntu:~/alphacount/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -16,11 +16,10 @@ If the number of arguments is different from 1, the program displays nothing.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/alphamirror$ go build
|
$ go run . "abc"
|
||||||
student@ubuntu:~/alphamirror$ ./alphamirror "abc"
|
|
||||||
zyx
|
zyx
|
||||||
student@ubuntu:~/alphamirror$ ./alphamirror "My horse is Amazing." | cat -e
|
$ go run . "My horse is Amazing." | cat -e
|
||||||
Nb slihv rh Znzarmt.$
|
Nb slihv rh Znzarmt.$
|
||||||
student@ubuntu:~/alphamirror$ ./alphamirror
|
$ go run .
|
||||||
student@ubuntu:~/alphamirror$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,9 +41,8 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/any/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/any/test$ ./test
|
|
||||||
false
|
false
|
||||||
true
|
true
|
||||||
student@ubuntu:~/any/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -39,9 +39,8 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/appendrange/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/appendrange/test$ ./test
|
|
||||||
[5 6 7 8 9]
|
[5 6 7 8 9]
|
||||||
[]
|
[]
|
||||||
student@ubuntu:~/appendrange/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/arrange_it/test$ cargo run
|
$ cargo run
|
||||||
"This is a Test"
|
"This is a Test"
|
||||||
student@ubuntu:~/arrange_it/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -54,10 +54,10 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```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 [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
|
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]
|
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$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -68,8 +68,7 @@ etc
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/ascii-art$ go build
|
$ go run . "hello"
|
||||||
student@ubuntu:~/ascii-art$ ./ascii-art "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$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -26,8 +26,7 @@ This project will help you learn about :
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/ascii-art$ go build
|
$ go run . "hello" standard
|
||||||
student@ubuntu:~/ascii-art$ ./ascii-art "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 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
|
O
|
||||||
|
|
||||||
|
|
||||||
student@ubuntu:~/ascii-art$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -32,8 +32,7 @@ This project will help you learn about :
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|student@ubuntu:~/ascii-art$ go build |
|
|$ go run . "hello" standard --align=center |
|
||||||
|student@ubuntu:~/ascii-art$ ./ascii-art "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$ |
|
|$ |
|
||||||
```
|
```
|
||||||
|
|
|
@ -27,9 +27,8 @@ This project will help you learn about :
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/ascii-art$ go build
|
$ go run . "hello" standard --output=banner.txt
|
||||||
student@ubuntu:~/ascii-art$ ./ascii-art "hello" standard --output=banner.txt
|
$ cat banner.txt
|
||||||
student@ubuntu:~/ascii-art$ 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
|
$ go run . "Hello There!" shadow --output=banner.txt
|
||||||
student@ubuntu:~/ascii-art$ cat banner.txt
|
$ cat banner.txt
|
||||||
|
|
||||||
_| _| _| _| _|_|_|_|_| _| _|
|
_| _| _| _| _|_|_|_|_| _| _|
|
||||||
_| _| _|_| _| _| _|_| _| _|_|_| _|_| _| _|_| _|_| _|
|
_| _| _|_| _| _| _|_| _| _|_|_| _|_| _| _|_| _|_| _|
|
||||||
|
@ -50,5 +49,5 @@ _| _| _|_|_| _| _| _|_| _| _| _| _|_|_| _| _
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
student@ubuntu:~/ascii-art$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -30,8 +30,7 @@ This project will help you learn about :
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/ascii-art$ go build
|
$ cat file.txt
|
||||||
student@ubuntu:~/ascii-art$ 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
|
hello
|
||||||
student@ubuntu:~/ascii-art$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -45,8 +45,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/atoi/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/atoi/test$ ./test
|
|
||||||
12345
|
12345
|
||||||
12345
|
12345
|
||||||
0
|
0
|
||||||
|
@ -55,5 +54,5 @@ student@ubuntu:~/atoi/test$ ./test
|
||||||
-1234
|
-1234
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
student@ubuntu:~/atoi/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -50,12 +50,11 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/atoibase/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/atoibase/test$ ./test
|
|
||||||
125
|
125
|
||||||
125
|
125
|
||||||
125
|
125
|
||||||
125
|
125
|
||||||
0
|
0
|
||||||
student@ubuntu:~/atoibase/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -14,15 +14,15 @@ It will only be tested strings containing the characters 'C' and 'D'.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/balancedstring$ go build
|
$ go run . "CDCCDDCDCD"
|
||||||
student@ubuntu:~/balancedstring$ ./balancedstring "CDCCDDCDCD"
|
|
||||||
4
|
4
|
||||||
student@ubuntu:~/balancedstring$ ./balancedstring "CDDDDCCCDC"
|
$ go run . "CDDDDCCCDC"
|
||||||
3
|
3
|
||||||
student@ubuntu:~/balancedstring$ ./balancedstring "DDDDCCCC"
|
$ go run . "DDDDCCCC"
|
||||||
1
|
1
|
||||||
student@ubuntu:~/balancedstring$ ./balancedstring "CDCCCDDCDD"
|
$ go run . "CDCCCDDCDD"
|
||||||
2
|
2
|
||||||
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
In first example "CDCCDDCDCD" can be split into "CD", "CCDD", "CD", "CD", each substring contains same number of 'C' and 'D'.
|
In first example "CDCCDDCDCD" can be split into "CD", "CCDD", "CD", "CD", each substring contains same number of 'C' and 'D'.
|
||||||
|
|
|
@ -111,10 +111,10 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/banner/test$ cargo run
|
$ cargo run
|
||||||
"0.5"
|
"0.5"
|
||||||
"0"
|
"0"
|
||||||
"invalid float literal"
|
"invalid float literal"
|
||||||
"invalid float literal"
|
"invalid float literal"
|
||||||
student@ubuntu:~/banner/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -40,10 +40,9 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/basicatoi/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/basicatoi/test$ ./test
|
|
||||||
12345
|
12345
|
||||||
12345
|
12345
|
||||||
0
|
0
|
||||||
student@ubuntu:~/basicatoi/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,11 +41,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/basicatoi2/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/basicatoi2/test$ ./test
|
|
||||||
12345
|
12345
|
||||||
12345
|
12345
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
student@ubuntu:~/basicatoi2/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -33,8 +33,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/basicjoin/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/basicjoin/test$ ./test
|
|
||||||
Hello! How are you?
|
Hello! How are you?
|
||||||
student@ubuntu:~/basicjoin/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,7 +38,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/bigger/test$ cargo run
|
$ cargo run
|
||||||
The biggest of the elements in the HashMap is 334
|
The biggest of the elements in the HashMap is 334
|
||||||
student@ubuntu:~/bigger/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -104,9 +104,9 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/blood_types/test$ cargo run
|
$ cargo run
|
||||||
recipients of O+ [AB+, O+, A+, B+]
|
recipients of O+ [AB+, O+, A+, B+]
|
||||||
donors of O+ [O+, O-]
|
donors of O+ [O+, O-]
|
||||||
donors of O+ can receive from A- false
|
donors of O+ can receive from A- false
|
||||||
student@ubuntu:~/blood_types/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -84,9 +84,9 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```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 }]
|
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+ [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
|
donors of O+ can receive from BloodType { antigen: O, rh_factor: Positive } true
|
||||||
student@ubuntu:~/blood_types_s/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -40,9 +40,8 @@ func main() {
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/boolean$ go build
|
$ go run . "not" "odd"
|
||||||
student@ubuntu:~/boolean$ ./boolean "not" "odd"
|
|
||||||
I have an even number of arguments
|
I have an even number of arguments
|
||||||
student@ubuntu:~/boolean$ ./boolean "not even"
|
$ go run . "not even"
|
||||||
I have an odd number of arguments
|
I have an odd number of arguments
|
||||||
```
|
```
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/border_cross/test$ cargo run
|
$ cargo run
|
||||||
["Model 3", "Ranger"]
|
["Model 3", "Ranger"]
|
||||||
student@ubuntu:~/border_cross/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -33,9 +33,9 @@ fn main() {
|
||||||
|
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```rust
|
```console
|
||||||
student@ubuntu:~/borrow/test$ cargo run
|
$ cargo run
|
||||||
str_len("hello") = 5
|
str_len("hello") = 5
|
||||||
str_len("camelCase") = 9
|
str_len("camelCase") = 9
|
||||||
student@ubuntu:~/borrow/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -82,10 +82,10 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/borrow_box/test$ cargo run
|
$ cargo run
|
||||||
("Same score! tied", 0)
|
("Same score! tied", 0)
|
||||||
("Same score! tied", 2)
|
("Same score! tied", 2)
|
||||||
("Joao", 3)
|
("Joao", 3)
|
||||||
"game deleted: id -> 0"
|
"game deleted: id -> 0"
|
||||||
student@ubuntu:~/borrow_box/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/borrow_me_the_reference/test$ cargo run
|
$ cargo run
|
||||||
("borrow", ["✔", "✔", "✘", "✔"], 75)
|
("borrow", ["✔", "✔", "✘", "✔"], 75)
|
||||||
student@ubuntu:~/borrow_me_the_reference/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -50,10 +50,10 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/box_it/test$ cargo run
|
$ cargo run
|
||||||
Box value : [5500, 8900, 32]
|
Box value : [5500, 8900, 32]
|
||||||
size occupied in the stack : 8 bytes
|
size occupied in the stack : 8 bytes
|
||||||
value : [5500, 8900, 32]
|
value : [5500, 8900, 32]
|
||||||
size occupied in the stack : 24 bytes
|
size occupied in the stack : 24 bytes
|
||||||
student@ubuntu:~/box_it/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -72,9 +72,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```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 }) }) }) }) }
|
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"))
|
Some(("Alice", "Normal Worker"))
|
||||||
WorkEnvironment { grade: None }
|
WorkEnvironment { grade: None }
|
||||||
student@ubuntu:~/box_recursion/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -165,9 +165,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```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 }] }
|
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
|
Todo List parse failed: None
|
||||||
Fail to parses todo Some(Malformed(UnexpectedCharacter { ch: ',', line: 2, column: 18 }))
|
Fail to parses todo Some(Malformed(UnexpectedCharacter { ch: ',', line: 2, column: 18 }))
|
||||||
student@ubuntu:~/boxing_todo/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,13 +13,13 @@ If there is no argument, the program must print nothing.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/brackets$ ./brackets '(johndoe)' | cat -e
|
$ go run . '(johndoe)' | cat -e
|
||||||
OK$
|
OK$
|
||||||
student@ubuntu:~/brackets$ ./brackets '([)]' | cat -e
|
$ go run . '([)]' | cat -e
|
||||||
Error$
|
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$
|
||||||
OK$
|
OK$
|
||||||
student@ubuntu:~/brackets$ ./brackets
|
$ go run .
|
||||||
student@ubuntu:~/brackets$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,13 +13,13 @@ If there is no argument, the program must print nothing.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/brackets_matching/brackets$ ./brackets '(johndoe)' | cat -e
|
$ go run . '(johndoe)' | cat -e
|
||||||
OK$
|
OK$
|
||||||
student@ubuntu:~/brackets_matching/brackets$ ./brackets '([)]' | cat -e
|
$ go run . '([)]' | cat -e
|
||||||
Error$
|
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$
|
||||||
OK$
|
OK$
|
||||||
student@ubuntu:~/brackets_matching/brackets$ ./brackets
|
$ go run .
|
||||||
student@ubuntu:~/brackets_matching/brackets$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -22,13 +22,12 @@ Any other character is a comment.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/brainfuck$ go build
|
$ go run . "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
||||||
student@ubuntu:~/brainfuck$ ./brainfuck "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." | cat -e
|
|
||||||
Hello World!$
|
Hello World!$
|
||||||
student@ubuntu:~/brainfuck$ ./brainfuck "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
$ go run . "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>." | cat -e
|
||||||
Hi$
|
Hi$
|
||||||
student@ubuntu:~/brainfuck$ ./brainfuck "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++." | cat -e
|
$ go run . "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++." | cat -e
|
||||||
abc$
|
abc$
|
||||||
student@ubuntu:~/brainfuck$ ./brainfuck
|
$ go run .
|
||||||
student@ubuntu:~/brainfuck$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -36,11 +36,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeapplybylevel/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeapplybylevel/test$ ./test
|
|
||||||
4
|
4
|
||||||
1
|
1
|
||||||
7
|
7
|
||||||
5
|
5
|
||||||
student@ubuntu:~/btreeapplybylevel/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,11 +37,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeapplyinorder/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeapplyinorder/test$ ./test
|
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
5
|
5
|
||||||
7
|
7
|
||||||
student@ubuntu:~/btreeapplyinorder/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,11 +37,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeapplypostorder/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeapplypostorder/test$ ./test
|
|
||||||
1
|
1
|
||||||
5
|
5
|
||||||
7
|
7
|
||||||
4
|
4
|
||||||
student@ubuntu:~/btreeapplypostorder/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,11 +37,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeapplypreorder/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeapplypreorder/test$ ./test
|
|
||||||
4
|
4
|
||||||
1
|
1
|
||||||
7
|
7
|
||||||
5
|
5
|
||||||
student@ubuntu:~/btreeapplypreorder/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -43,8 +43,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreedeletenode/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreedeletenode/test$ ./test
|
|
||||||
Before delete:
|
Before delete:
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
|
@ -54,5 +53,5 @@ After delete:
|
||||||
1
|
1
|
||||||
5
|
5
|
||||||
7
|
7
|
||||||
student@ubuntu:~/btreedeletenode/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -47,11 +47,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeinsertdata$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeinsertdata$ ./btreeinsertdata
|
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
5
|
5
|
||||||
7
|
7
|
||||||
student@ubuntu:~/btreeinsertdata$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -36,8 +36,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeisbinary/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeisbinary/test$ ./test
|
|
||||||
true
|
true
|
||||||
student@ubuntu:~/btreeisbinary/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,8 +37,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreelevelcount/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreelevelcount/test$ ./test
|
|
||||||
3
|
3
|
||||||
student@ubuntu:~/btreelevelcount/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,8 +38,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreemax/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreemax/test$ ./test
|
|
||||||
7
|
7
|
||||||
student@ubuntu:~/btreemax/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,8 +38,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreemin/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreemin/test$ ./test
|
|
||||||
1
|
1
|
||||||
student@ubuntu:~/btreemin/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,10 +38,9 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreeprintroot/printroot$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreeprintroot/printroot$ ./printroot
|
|
||||||
who
|
who
|
||||||
are
|
are
|
||||||
you
|
you
|
||||||
student@ubuntu:~/btreeprintroot/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -63,11 +63,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreesearchitem/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreesearchitem/test$ ./test
|
|
||||||
Item selected -> 7
|
Item selected -> 7
|
||||||
Parent of selected item -> 4
|
Parent of selected item -> 4
|
||||||
Left child of selected item -> 5
|
Left child of selected item -> 5
|
||||||
Right child of selected item -> nil
|
Right child of selected item -> nil
|
||||||
student@ubuntu:~/btreesearchitem/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -39,11 +39,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/btreetransplant/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/btreetransplant/test$ ./test
|
|
||||||
3
|
3
|
||||||
4
|
4
|
||||||
5
|
5
|
||||||
7
|
7
|
||||||
student@ubuntu:~/btreetransplant/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -34,8 +34,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/capitalize/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/capitalize/test$ ./test
|
|
||||||
Hello! How Are You? How+Are+Things+4you?
|
Hello! How Are You? How+Are+Things+4you?
|
||||||
student@ubuntu:~/capitalize/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,9 +38,9 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```consoole
|
```consoole
|
||||||
student@ubuntu:~/capitalizing/test$ cargo run
|
$ cargo run
|
||||||
Joe is missing
|
Joe is missing
|
||||||
Jill Is Leaving A
|
Jill Is Leaving A
|
||||||
HEllO thERE
|
HEllO thERE
|
||||||
student@ubuntu:~/capitalizing/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -82,7 +82,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/card_deck/test$ cargo run
|
$ cargo run
|
||||||
Your card is Card { suit: Club, rank: Ace }
|
Your card is Card { suit: Club, rank: Ace }
|
||||||
student@ubuntu:~/card_deck/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -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).
|
- If the program is called without arguments it should take the standard input (stdin) and print it back on the standard output (stdout).
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cat$ echo '"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing' > quest8.txt
|
$ 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
|
$ 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."
|
"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
|
EOF
|
||||||
student@ubuntu:~/cat$ go build
|
$ go run . abc
|
||||||
student@ubuntu:~/cat$ ./cat abc
|
|
||||||
ERROR: abc: No such file or directory
|
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
|
"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
|
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
|
||||||
ERROR: abc: No such file or directory
|
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
|
"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
|
||||||
Hello
|
Hello
|
||||||
^C
|
^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
|
"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."
|
"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$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -54,7 +54,7 @@ func main() {
|
||||||
Its output:
|
Its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ go build
|
$ go run .
|
||||||
$ ./main
|
|
||||||
1 -> 3 -> 5 -> 2 -> 4
|
1 -> 3 -> 5 -> 2 -> 4
|
||||||
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -54,8 +54,8 @@ fn main() {
|
||||||
And its expected output
|
And its expected output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/changes/test$ cargo run
|
$ cargo run
|
||||||
brightness = 0
|
brightness = 0
|
||||||
new brightness = 200
|
new brightness = 200
|
||||||
student@ubuntu:~/changes/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -33,12 +33,11 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/chunk/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/chunk/test$ ./test
|
|
||||||
[]
|
[]
|
||||||
|
|
||||||
[[0 1 2] [3 4 5] [6 7]]
|
[[0 1 2] [3 4 5] [6 7]]
|
||||||
[[0 1 2 3 4] [5 6 7]]
|
[[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$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -48,9 +48,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cipher/test$ cargo run
|
$ cargo run
|
||||||
Some(Ok(true))
|
Some(Ok(true))
|
||||||
Some(Err(CipherError { validation: false, expected: "1Svool 2dliow!" }))
|
Some(Err(CipherError { validation: false, expected: "1Svool 2dliow!" }))
|
||||||
None
|
None
|
||||||
student@ubuntu:~/cipher/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -93,11 +93,11 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```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 } area = 70685.83470577035
|
||||||
circle = Circle { center: Point { x: 500.0, y: 500.0 }, radius: 150.0 } diameter = 300
|
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
|
circle1 = Circle { center: Point { x: 80.0, y: 115.0 }, radius: 30.0 } diameter = 60
|
||||||
circle and circle1 intersect = false
|
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
|
distance between Point { x: 1.0, y: 1.0 } and Point { x: 0.0, y: 0.0 } is 1.4142135623730951
|
||||||
student@ubuntu:~/circle/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -11,7 +11,7 @@ A line is a sequence of characters preceding the [end of line](https://en.wikipe
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cl-camp2/test$ cat -e r
|
$ cat -e r
|
||||||
R$
|
R$
|
||||||
student@ubuntu:~/cl-camp2/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -17,8 +17,8 @@ Create a file `myfamily.sh`, which will show a subject's family (key: relatives)
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cl-camp4/test$ export HERO_ID=1
|
$ export HERO_ID=1
|
||||||
student@ubuntu:~/cl-camp4/test$ ./myfamily.sh
|
$ ./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)
|
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$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -13,11 +13,11 @@ That command will only show the name of the files without the `.sh`.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cl-camp5/test$ ./lookagain.sh | cat -e
|
$ ./lookagain.sh | cat -e
|
||||||
file1$
|
file1$
|
||||||
file2$
|
file2$
|
||||||
file3$
|
file3$
|
||||||
student@ubuntu:~/cl-camp5/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
### Hint
|
### Hint
|
||||||
|
|
|
@ -9,7 +9,7 @@ Create a file `countfiles.sh`, which will print the number **(and only the numbe
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cl-camp6/test$ ./countfiles.sh | cat -e
|
$ ./countfiles.sh | cat -e
|
||||||
12$
|
12$
|
||||||
student@ubuntu:~/cl-camp6/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,7 +9,7 @@ Create a file `"\?$*'ChouMi'*$?\"` that will contain "01" and **nothing else**.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cl-camp7/test$ ls | cat -e
|
$ ls | cat -e
|
||||||
"\?$*'ChouMi'*$?\"$
|
"\?$*'ChouMi'*$?\"$
|
||||||
student@ubuntu:~/cl-camp7/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -17,13 +17,12 @@ program displays nothing.
|
||||||
### Usage :
|
### Usage :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/cleanstr$ go build
|
$ go run . "you see it's easy to display the same thing" | cat -e
|
||||||
student@ubuntu:~/cleanstr$ ./cleanstr "you see it's easy to display the same thing" | cat -e
|
|
||||||
you see it's easy to display the same thing$
|
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$
|
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$
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,7 +35,7 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/closures/test$ cargo run
|
$ cargo run
|
||||||
All elements in [4, 16, 36, ..., 10000], len = 50
|
All elements in [4, 16, 36, ..., 10000], len = 50
|
||||||
student@ubuntu:~/closures/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,8 +35,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/{{ROOT}}/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/{{ROOT}}/test$ ./test
|
|
||||||
9
|
9
|
||||||
student@ubuntu:~/{{ROOT}}/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -32,8 +32,8 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/collect/test$ cargo run
|
$ cargo run
|
||||||
[1, 2, 3, 4, 5, 7]
|
[1, 2, 3, 4, 5, 7]
|
||||||
[1, 2, 3, 4, 5, 7]
|
[1, 2, 3, 4, 5, 7]
|
||||||
student@ubuntu:~/collect/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -11,10 +11,9 @@ Write a program `comcheck` that displays on the standard output `Alert!!!` follo
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/comcheck$ go build
|
$ go run . "I" "Will" "Enter" "the" "galaxy"
|
||||||
student@ubuntu:~/comcheck$ ./comcheck "I" "Will" "Enter" "the" "galaxy"
|
|
||||||
Alert!!!
|
Alert!!!
|
||||||
student@ubuntu:~/comcheck$ ./comcheck "galaxy 01" "do" "you" "hear" "me"
|
$ go run . "galaxy 01" "do" "you" "hear" "me"
|
||||||
Alert!!!
|
Alert!!!
|
||||||
student@ubuntu:~/comcheck$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -51,8 +51,8 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```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}
|
{"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}
|
{"homembaixinho": 2, "mwenzkowski": 3, ... ,"tamirzb": 1, "paul-ri": 2, "RPigott": 1}
|
||||||
student@ubuntu:~/commits_stats/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -53,8 +53,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/compact/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/compact/test$ ./test
|
|
||||||
a
|
a
|
||||||
|
|
||||||
b
|
b
|
||||||
|
@ -65,5 +64,5 @@ Size after compacting: 3
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
c
|
c
|
||||||
student@ubuntu:~/compact/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -34,10 +34,9 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/compare/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/compare/test$ ./test
|
|
||||||
0
|
0
|
||||||
-1
|
-1
|
||||||
1
|
1
|
||||||
student@ubuntu:~/compare/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -33,8 +33,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/concat/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/concat/test$ ./test
|
|
||||||
Hello! How are you?
|
Hello! How are you?
|
||||||
student@ubuntu:~/concat/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -34,11 +34,10 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/concatparams/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/concatparams/test$ ./test
|
|
||||||
Hello
|
Hello
|
||||||
how
|
how
|
||||||
are
|
are
|
||||||
you?
|
you?
|
||||||
student@ubuntu:~/concatparams/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,8 +37,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/convertbase/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/convertbase/test$ ./test
|
|
||||||
43
|
43
|
||||||
student@ubuntu:~/convertbase/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -60,9 +60,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/copy/test$ cargo run
|
$ cargo run
|
||||||
(0, 1.0, inf)
|
(0, 1.0, inf)
|
||||||
("1 2 4 5 6", "2.718281828459045 7.38905609893065 54.598150033144236 148.4131591025766 403.4287934927351")
|
("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])
|
([1, 2, 4, 5], [0.0, 0.6931471805599453, 1.3862943611198906, 1.6094379124341003])
|
||||||
student@ubuntu:~/copy/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -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.
|
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
|
```console
|
||||||
$ ./main 12 11 13 20 4 6
|
$ go run . 12 11 13 20 4 6
|
||||||
102
|
102
|
||||||
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,8 +7,7 @@ Write a program that displays all digits in descending order, followed by a newl
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/countdown/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/countdown/test$ ./test
|
|
||||||
9876543210
|
9876543210
|
||||||
student@ubuntu:~/countdown/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -37,9 +37,8 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/countif/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/countif/test$ ./test
|
|
||||||
0
|
0
|
||||||
2
|
2
|
||||||
student@ubuntu:~/countif/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,9 +42,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/counting_words/test$ cargo run
|
$ cargo run
|
||||||
{"hello": 1, "world": 1}
|
{"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}
|
{"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}
|
{"batman": 3, "stop": 2}
|
||||||
student@ubuntu:~/counting_words/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,8 +38,7 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/createelem/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/createelem/test$ ./test
|
|
||||||
&{1234}
|
&{1234}
|
||||||
student@ubuntu:~/createelem/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -27,8 +27,8 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/delete_prefix/test$ cargo run
|
$ cargo run
|
||||||
Some("cdefghijklmnop")
|
Some("cdefghijklmnop")
|
||||||
None
|
None
|
||||||
student@ubuntu:~/delete_prefix/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -43,8 +43,8 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/diamond_creation/test$ cargo run
|
$ cargo run
|
||||||
["A"]
|
["A"]
|
||||||
[" A ", " B B ", "C C", " B B ", " A "]
|
[" A ", " B B ", "C C", " B B ", " A "]
|
||||||
student@ubuntu:~/diamond_creation/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -74,11 +74,11 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/display_table/test$ cargo run
|
$ cargo run
|
||||||
| Model | Piece N° | In Stock | Description |
|
| Model | Piece N° | In Stock | Description |
|
||||||
|---------+-------------+-----------+-------------|
|
|---------+-------------+-----------+-------------|
|
||||||
| model 1 | 43-EWQE304 | 30 | Piece for x |
|
| model 1 | 43-EWQE304 | 30 | Piece for x |
|
||||||
| model 2 | 98-QCVX5433 | 100000000 | - |
|
| model 2 | 98-QCVX5433 | 100000000 | - |
|
||||||
| model y | 78-NMNH | 60 | nothing |
|
| model y | 78-NMNH | 60 | nothing |
|
||||||
student@ubuntu:~/display_table/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,12 +9,11 @@ If the number of arguments is not 1, the program displays an `a` followed by a n
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displaya/test$ go build
|
$ go run . "abc"
|
||||||
student@ubuntu:~/displaya/test$ ./test "abc"
|
|
||||||
a
|
a
|
||||||
student@ubuntu:~/displaya/test$ ./test "bcvbvA"
|
$ go run . "bcvbvA"
|
||||||
a
|
a
|
||||||
student@ubuntu:~/displaya/test$ ./test "nbv"
|
$ go run . "nbv"
|
||||||
a
|
a
|
||||||
student@ubuntu:~/displaya/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,8 +7,7 @@ Write a program that displays the alphabet, with even letters in uppercase, and
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displayalpham$ go build
|
$ go run . | cat -e
|
||||||
student@ubuntu:~/displayalpham$ ./displayalpham | cat -e
|
|
||||||
aBcDeFgHiJkLmNoPqRsTuVwXyZ$
|
aBcDeFgHiJkLmNoPqRsTuVwXyZ$
|
||||||
student@ubuntu:~/displayalpham$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,8 +7,7 @@ Write a program that displays the alphabet in reverse, with even letters in uppe
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displayalrevm$ go build
|
$ go run . | cat -e
|
||||||
student@ubuntu:~/displayalrevm$ ./displayalrevm | cat -e
|
|
||||||
zYxWvUtSrQpOnMlKjIhGfEdCbA$
|
zYxWvUtSrQpOnMlKjIhGfEdCbA$
|
||||||
student@ubuntu:~/displayalrevm$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,13 +7,12 @@ Write a program that displays, on the standard output, the content of a file giv
|
||||||
### Usage :
|
### Usage :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displayfile$ go build
|
$ go run .
|
||||||
student@ubuntu:~/displayfile$ ./displayfile
|
|
||||||
File name missing
|
File name missing
|
||||||
student@ubuntu:~/displayfile$ echo "Almost there!!" > quest8.txt
|
$ echo "Almost there!!" > quest8.txt
|
||||||
student@ubuntu:~/displayfile$ ./displayfile quest8.txt main.go
|
$ go run . quest8.txt main.go
|
||||||
Too many arguments
|
Too many arguments
|
||||||
student@ubuntu:~/displayfile$ ./displayfile quest8.txt
|
$ go run . quest8.txt
|
||||||
Almost there!!
|
Almost there!!
|
||||||
student@ubuntu:~/displayfile$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,11 +7,10 @@ Write a program that displays its first argument, if there is one.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displayfirstparam/test$ go build
|
$ go run . hello there
|
||||||
student@ubuntu:~/displayfirstparam/test$ ./test hello there
|
|
||||||
hello
|
hello
|
||||||
student@ubuntu:~/displayfirstparam/test$ ./test "hello there" how are you
|
$ go run . "hello there" how are you
|
||||||
hello there
|
hello there
|
||||||
student@ubuntu:~/displayfirstparam/test$ ./test
|
$ go run .
|
||||||
student@ubuntu:~/displayfirstparam/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,13 +7,12 @@ Write a program that displays its last argument, if there is one.
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displaylastparam/test$ go build
|
$ go run . hello there
|
||||||
student@ubuntu:~/displaylastparam/test$ ./test hello there
|
|
||||||
there
|
there
|
||||||
student@ubuntu:~/displaylastparam/test$ ./test "hello there" how are you
|
$ go run . "hello there" how are you
|
||||||
you
|
you
|
||||||
student@ubuntu:~/displaylastparam/test$ ./test "hello there"
|
$ go run . "hello there"
|
||||||
hello there
|
hello there
|
||||||
student@ubuntu:~/displaylastparam/test$ ./test
|
$ go run .
|
||||||
student@ubuntu:~/displaylastparam/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,12 +9,11 @@ If the number of arguments is not 1, the program displays an `z` followed by a n
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/displayz/test$ go build
|
$ go run . "xyz"
|
||||||
student@ubuntu:~/displayz/test$ ./test "xyz"
|
|
||||||
z
|
z
|
||||||
student@ubuntu:~/displayz/test$ ./test "bcvbvZ"
|
$ go run . "bcvbvZ"
|
||||||
z
|
z
|
||||||
student@ubuntu:~/displayz/test$ ./test "nbv"
|
$ go run . "nbv"
|
||||||
z
|
z
|
||||||
student@ubuntu:~/displayz/test$ ./test
|
$ go run .
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,7 +41,7 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/division_and_remainder/test$ cargo run
|
$ cargo run
|
||||||
9/4: division = 2, remainder = 1
|
9/4: division = 2, remainder = 1
|
||||||
student@ubuntu:~/division_and_remainder/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,9 +42,8 @@ func main() {
|
||||||
And its output :
|
And its output :
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/divmod/test$ go build
|
$ go run .
|
||||||
student@ubuntu:~/divmod/test$ ./test
|
|
||||||
6
|
6
|
||||||
1
|
1
|
||||||
student@ubuntu:~/divmod/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -17,25 +17,24 @@ The program has to handle the modulo and division operations by 0 as shown on th
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/doop/test$ go build doop.go
|
$ go run .
|
||||||
student@ubuntu:~/doop/test$ ./doop
|
$ go run . 1 + 1 | cat -e
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 + 1 | cat -e
|
|
||||||
2$
|
2$
|
||||||
student@ubuntu:~/doop/test$ ./doop hello + 1
|
$ go run . hello + 1
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 p 1
|
$ go run . 1 p 1
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 / 0 | cat -e
|
$ go run . 1 / 0 | cat -e
|
||||||
No division by 0$
|
No division by 0$
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 % 0 | cat -e
|
$ go run . 1 % 0 | cat -e
|
||||||
No modulo by 0$
|
No modulo by 0$
|
||||||
student@ubuntu:~/doop/test$ ./doop 9223372036854775807 + 1
|
$ go run . 9223372036854775807 + 1
|
||||||
0
|
0
|
||||||
student@ubuntu:~/doop/test$ ./doop -9223372036854775809 - 3
|
$ go run . -9223372036854775809 - 3
|
||||||
0
|
0
|
||||||
student@ubuntu:~/doop/test$ ./doop 9223372036854775807 "*" 3
|
$ go run . 9223372036854775807 "*" 3
|
||||||
0
|
0
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 "*" 1
|
$ go run . 1 "*" 1
|
||||||
1
|
1
|
||||||
student@ubuntu:~/doop/test$ ./doop 1 "*" -1
|
$ go run . 1 "*" -1
|
||||||
-1
|
-1
|
||||||
student@ubuntu:~/doop/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,8 +38,8 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/doubtful/test$ cargo run
|
$ cargo run
|
||||||
Before changing the string: Hello
|
Before changing the string: Hello
|
||||||
After changing the string: Hello?
|
After changing the string: Hello?
|
||||||
student@ubuntu:~/doubtful/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -105,9 +105,9 @@ fn main() {
|
||||||
And its output:
|
And its output:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/drop_the_thread/test$ cargo run
|
$ cargo run
|
||||||
(true, 0, Cell { value: 1 })
|
(true, 0, Cell { value: 1 })
|
||||||
(true, 1, Cell { value: 2 })
|
(true, 1, Cell { value: 2 })
|
||||||
(false, 2, Cell { value: 2 }, 1)
|
(false, 2, Cell { value: 2 }, 1)
|
||||||
student@ubuntu:~/drop_the_thread/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,8 +42,8 @@ fn main() {
|
||||||
And its output
|
And its output
|
||||||
|
|
||||||
```console
|
```console
|
||||||
student@ubuntu:~/easy_traits/test$ cargo run
|
$ cargo run
|
||||||
hello world
|
hello world
|
||||||
["one", "two", "three"]
|
["one", "two", "three"]
|
||||||
student@ubuntu:~/easy_traits/test$
|
$
|
||||||
```
|
```
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue