mirror of https://github.com/01-edu/public.git
test and resources for quest-03
This commit is contained in:
parent
d2d521d62b
commit
661eeae5bc
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
- For this exercise the handling of the signs + or - **does have** to be taken into account.
|
- For this exercise the handling of the signs + or - **does have** to be taken into account.
|
||||||
|
|
||||||
- This function will **only** have to return the `int`. For this exercise the `error` result of atoi is not required.
|
- This function will **only** have to return the `int`. For this exercise the `error` result of `Atoi` is not required.
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
@ -56,3 +56,7 @@ $ go run .
|
||||||
0
|
0
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [strconv/Atoi](https://golang.org/pkg/strconv/#Atoi)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number defined as a `string` in a number defined as an `int`.
|
- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number defined as a `string` in a number defined as an `int`.
|
||||||
|
|
||||||
- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **only valid** `string` will be tested. They will only contain one or several digits as characters.
|
- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **only valid** `string` will be tested. They will only contain one or several digits as characters.
|
||||||
|
|
||||||
- For this exercise the handling of the signs `+` or `-` does not have to be taken into account.
|
- For this exercise the handling of the signs `+` or `-` does not have to be taken into account.
|
||||||
|
|
||||||
|
@ -46,3 +46,7 @@ $ go run .
|
||||||
0
|
0
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [strconv/Atoi](https://golang.org/pkg/strconv/#Atoi)
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number defined as a `string` in a number defined as an `int`.
|
- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number defined as a `string` in a number defined as an `int`.
|
||||||
|
|
||||||
- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters.
|
- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters.
|
||||||
|
|
||||||
- For this exercise the handling of the signs `+` or `-` does not have to be taken into account.
|
- For this exercise the handling of the signs `+` or `-` does not have to be taken into account.
|
||||||
|
|
||||||
- This function will **only** have to return the `int`. For this exercise the `error` return of atoi is not required.
|
- This function will **only** have to return the `int`. For this exercise the `error` return of `Atoi` is not required.
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
@ -48,3 +48,7 @@ $ go run .
|
||||||
0
|
0
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [strconv/Atoi](https://golang.org/pkg/strconv/#Atoi)
|
||||||
|
|
|
@ -12,9 +12,9 @@ func DivMod(a int, b int, div *int, mod *int) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- This function will divide the int **a** and **b**.
|
- This function will divide the `int` **a** and **b**.
|
||||||
- The result of this division will be stored in the int pointed by **div**.
|
- The result of this division will be stored in the `int` pointed by **div**.
|
||||||
- The remainder of this division will be stored in the int pointed by **mod**.
|
- The remainder of this division will be stored in the `int` pointed by **mod**.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -47,3 +47,7 @@ $ go run .
|
||||||
1
|
1
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [Pointers](https://golang.org/ref/spec#Pointer_types)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
|
|
||||||
- Write a function that takes a **pointer to an int** as argument and gives to this int the value of 1.
|
- Write a function that takes a **pointer to an `int`** as argument and gives to this `int` the value of 1.
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
@ -38,3 +38,7 @@ $ go run .
|
||||||
1
|
1
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [Pointers](https://golang.org/ref/spec#Pointer_types)
|
||||||
|
|
|
@ -33,3 +33,7 @@ $ go run . | cat -e
|
||||||
Hello World!%
|
Hello World!%
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [01-edu/z01](https://github.com/01-edu/z01)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
- Write a function that reverses a `string`.
|
- Write a function that reverses a `string`.
|
||||||
|
|
||||||
- This function will **return** the s `string`.
|
- This function will **return** the reversed `string`.
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
|
|
||||||
- Write a function that swaps the contents of two **pointers to an int** (`*int`).
|
- Write a function that swaps the contents of two **pointers to an `int`** (`*int`).
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
@ -41,3 +41,7 @@ $ go run .
|
||||||
0
|
0
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [Pointers](https://golang.org/ref/spec#Pointer_types)
|
||||||
|
|
|
@ -12,9 +12,9 @@ func UltimateDivMod(a *int, b *int) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- This function will divide the int **a** and **b**.
|
- This function will divide the `int` **a** and **b**.
|
||||||
- The result of this division will be stored in the int pointed by **a**.
|
- The result of this division will be stored in the `int` pointed by **a**.
|
||||||
- The remainder of this division will be stored in the int pointed by **b**.
|
- The remainder of this division will be stored in the `int` pointed by **b**.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -45,3 +45,7 @@ $ go run .
|
||||||
1
|
1
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [Pointers](https://golang.org/ref/spec#Pointer_types)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
### Instructions
|
### Instructions
|
||||||
|
|
||||||
- Write a function that takes a **pointer to a pointer to a pointer to an int** as argument and gives to this int the value of 1.
|
- Write a function that takes a **pointer to a pointer to a pointer to an `int`** as argument and gives to this `int` the value of 1.
|
||||||
|
|
||||||
### Expected function
|
### Expected function
|
||||||
|
|
||||||
|
@ -40,3 +40,7 @@ $ go run .
|
||||||
1
|
1
|
||||||
$
|
$
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Notions
|
||||||
|
|
||||||
|
- [Pointers](https://golang.org/ref/spec#Pointer_types)
|
||||||
|
|
Loading…
Reference in New Issue