mirror of https://github.com/01-edu/public.git
Tiago Collot
2 years ago
1 changed files with 39 additions and 0 deletions
@ -0,0 +1,39 @@
|
||||
## dealapackofcards |
||||
|
||||
### Instructions |
||||
|
||||
Deal a pack of `12` cards evenly between 4 players, `Player 1`, `Player 2`, `Player 3` and `Player 4`. |
||||
|
||||
Write a function `DealAPackOfCards()` that takes an argument `deck` as an `int` and prints the desired output. |
||||
|
||||
- Each player must be printed in a different line. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func DealAPackOfCards (deck []int) { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
func main() { |
||||
deck := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} |
||||
DealAPackOfCards(deck) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```go |
||||
$ go run . | cat -e |
||||
Player 1: 1, 2, 3$ |
||||
Player 2: 4, 5, 6$ |
||||
Player 3: 7, 8, 9$ |
||||
Player 4: 10, 11, 12$ |
||||
$ |
||||
``` |
Loading…
Reference in new issue