diff --git a/subjects/addprimesum.en.md b/subjects/addprimesum.en.md index 2e66e68b6..c08260f8f 100644 --- a/subjects/addprimesum.en.md +++ b/subjects/addprimesum.en.md @@ -14,7 +14,7 @@ student@ubuntu:~/piscine-go/test$ ./test 5 10 student@ubuntu:~/piscine-go/test$ ./test 7 17 -student@ubuntu:~/piscine-go/test$ ./test 57 +student@ubuntu:~/piscine-go/test$ ./test 5 7 0 student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/addprimesum.fr.md b/subjects/addprimesum.fr.md index 2d73e4727..073294444 100644 --- a/subjects/addprimesum.fr.md +++ b/subjects/addprimesum.fr.md @@ -14,7 +14,7 @@ student@ubuntu:~/piscine-go/test$ ./test 5 10 student@ubuntu:~/piscine-go/test$ ./test 7 17 -student@ubuntu:~/piscine-go/test$ ./test 57 +student@ubuntu:~/piscine-go/test$ ./test 5 7 0 student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/fprime.en.md b/subjects/fprime.en.md index 2c3fb3e5f..147c115ae 100644 --- a/subjects/fprime.en.md +++ b/subjects/fprime.en.md @@ -24,7 +24,9 @@ student@ubuntu:~/piscine-go/test$ ./test 804577 804577 student@ubuntu:~/piscine-go/test$ ./test 42 2*3*7 -student@ubuntu:~/piscine-go/test$ ./test +student@ubuntu:~/piscine-go/test$ ./test a + +student@ubuntu:~/piscine-go/test$ ./test 0 student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/fprime.fr.md b/subjects/fprime.fr.md index 90d428bc5..3aa55c3d0 100644 --- a/subjects/fprime.fr.md +++ b/subjects/fprime.fr.md @@ -24,7 +24,9 @@ student@ubuntu:~/piscine-go/test$ ./test 804577 804577 student@ubuntu:~/piscine-go/test$ ./test 42 2*3*7 -student@ubuntu:~/piscine-go/test$ ./test +student@ubuntu:~/piscine-go/test$ ./test a + +student@ubuntu:~/piscine-go/test$ ./test 0 student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/printhex.en.md b/subjects/printhex.en.md index 92ca005eb..c1bdcd45a 100644 --- a/subjects/printhex.en.md +++ b/subjects/printhex.en.md @@ -5,6 +5,7 @@ Write a program that takes a positive (or zero) number expressed in base 10, and displays it in base 16 (with lowercase letters) followed by a newline (`'\n'`). - If the number of parameters is different from 1, the program displays a newline. +- Error cases have to be handled as shown in the example below. ### Usage @@ -16,7 +17,9 @@ student@ubuntu:~/piscine-go/test$ ./test "255" ff student@ubuntu:~/piscine-go/test$ ./test "5156454" 4eae66 -student@ubuntu:~/piscine-go/test$ +student@ubuntu:~/piscine-go/test$ ./test -student@ubuntu:~/piscine-go/ +student@ubuntu:~/piscine-go/test$ ./test "123 132 1" | cat -e +0$ +student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/printhex.fr.md b/subjects/printhex.fr.md index 8d85fb500..7960e6c30 100644 --- a/subjects/printhex.fr.md +++ b/subjects/printhex.fr.md @@ -5,6 +5,8 @@ Écrire un programme qui prend un nombre positif (ou zéro) écrit en base 10, et qui l'affiche en base 16 (avec les lettres en minuscule) suivi d'un retour à la ligne (`'\n'`). - Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne. +- Les cas d'erreurs doivent être gérés comme montré dans l'exemple ci-dessous. + ### Utilisation @@ -16,7 +18,9 @@ student@ubuntu:~/piscine-go/test$ ./test "255" ff student@ubuntu:~/piscine-go/test$ ./test "5156454" 4eae66 -student@ubuntu:~/piscine-go/test$ +student@ubuntu:~/piscine-go/test$ ./test -student@ubuntu:~/piscine-go/ +student@ubuntu:~/piscine-go/test$ ./test "123 132 1" | cat -e +0$ +student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/repeatalpha.en.md b/subjects/repeatalpha.en.md index a4acc32fb..da6088e14 100644 --- a/subjects/repeatalpha.en.md +++ b/subjects/repeatalpha.en.md @@ -19,10 +19,10 @@ If the number of arguments is different from 1, the program displays a newline ( student@ubuntu:~/piscine-go/repeatalpha$ go build student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abc" | cat -e abbccc -student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "Alex." | cat -e -Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ -student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abacadaba 42!" | cat -e -abbacccaddddabba 42!$ +student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "Choumi." | cat -e +CCChhhhhhhhooooooooooooooouuuuuuuuuuuuuuuuuuuuummmmmmmmmmmmmiiiiiiiii.$ +student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abacadaba 01!" | cat -e +abbacccaddddabba 01!$ student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha | cat -e $ student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "" | cat -e diff --git a/subjects/repeatalpha.fr.md b/subjects/repeatalpha.fr.md index 8d20d123a..39ff1c9ea 100644 --- a/subjects/repeatalpha.fr.md +++ b/subjects/repeatalpha.fr.md @@ -18,10 +18,10 @@ Si le nombre d'arguments est différent de 1, le programme affiche un retour à student@ubuntu:~/piscine-go/repeatalpha$ go build student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abc" | cat -e abbccc -student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "Alex." | cat -e -Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ -student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abacadaba 42!" | cat -e -abbacccaddddabba 42!$ +student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "Choumi." | cat -e +CCChhhhhhhhooooooooooooooouuuuuuuuuuuuuuuuuuuuummmmmmmmmmmmmiiiiiiiii.$ +student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "abacadaba 01!" | cat -e +abbacccaddddabba 01!$ student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha | cat -e $ student@ubuntu:~/piscine-go/repeatalpha$ ./repeatalpha "" | cat -e diff --git a/subjects/revwstr.en.md b/subjects/revwstr.en.md index 494e1aca6..921a963a5 100644 --- a/subjects/revwstr.en.md +++ b/subjects/revwstr.en.md @@ -20,7 +20,7 @@ student@ubuntu:~/piscine-go/test$ ./test "abcdefghijklm" abcdefghijklm student@ubuntu:~/piscine-go/test$ ./test "he stared at the mountain" mountain the at stared he -student@ubuntu:~/piscine-go/test$ ./test - -student@ubuntu:~/piscine-go/test$ +student@ubuntu:~/piscine-go/test$ ./test "" | cat-e +$ +student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/revwstr.fr.md b/subjects/revwstr.fr.md index 246826b99..97f0e177c 100644 --- a/subjects/revwstr.fr.md +++ b/subjects/revwstr.fr.md @@ -20,7 +20,7 @@ student@ubuntu:~/piscine-go/test$ ./test "abcdefghijklm" abcdefghijklm student@ubuntu:~/piscine-go/test$ ./test "he stared at the mountain" mountain the at stared he -student@ubuntu:~/piscine-go/test$ ./test - -student@ubuntu:~/piscine-go/test$ +student@ubuntu:~/piscine-go/test$ ./test "" | cat-e +$ +student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/rpncalc.en.md b/subjects/rpncalc.en.md index 34db8b282..956e79c81 100644 --- a/subjects/rpncalc.en.md +++ b/subjects/rpncalc.en.md @@ -23,7 +23,7 @@ All the given operands must fit in a `int`. Examples of formulas converted in RPN: 3 + 4 >> 3 4 + -((1 _ 2) _ 3) - 4 >> 1 2 _ 3 _ 4 - ou 3 1 2 \* _ 4 - +((1 _ 2) _ 3) - 4 >> 1 2 _ 3 _ 4 - or 3 1 2 \* _ 4 - 50 _ (5 - (10 / 9)) >> 5 10 9 / - 50 \* Here is how to evaluate a formula in RPN: diff --git a/subjects/strlenprog.fr.md b/subjects/strlenprog.fr.md index c25f1c717..949b4fce3 100644 --- a/subjects/strlenprog.fr.md +++ b/subjects/strlenprog.fr.md @@ -1,19 +1,52 @@ ## strlenprog +##**AVERTISSEMENT! TRÈS IMPORTANT!** + +Pour cet exercice une fonction sera testée **avec le main de l'examen**. Cependant l'étudiant **doit quand même** rendre un programme structuré: + +Cela signifie que: + +- Le package doit être nommé `package main`. +- Le code rendu doit avoir une fonction main déclarée(```func main()```) même si elle est vide. +- La fonction main déclarée doit **aussi passer** le `Restrictions Checker`(le testeur de fonctions illégales). Il est conseillé à l'étudiant de rendre une fonction main vide après ses tests finis. +- Toutes les autres régles sont les mêmes que pour un `programme`. + ### Instructions -- Écrire un programme qui compte le nombre de caractères d'une `string` et qui retourne le nombre trouvé. +- Écrire une fonction qui compte le nombre de caractères d'une `string` et qui retourne le nombre trouvé. -- Si le programme reçoit plusieurs ou aucun arguments il ne doit rien afficher. +### Fonction attendue + +```go +func StrLen(str string) int { + +} +``` + +### Utilisation + +Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : + +```go +package main + +import ( + "fmt" + piscine ".." +) + +func main() { + str := "Hello World!" + nb := piscine.StrLen(str) + fmt.Println(nb) +} +``` -### Utilisation : +Et son résultat : ```console -student@ubuntu:~/piscine-go/strlenprog$ go build -student@ubuntu:~/piscine-go/strlenprog$ ./strlenprog "hello" | cat -e -5$ -student@ubuntu:~/piscine-go/strlenprog$ ./strlenprog -student@ubuntu:~/piscine-go/strlenprog$ -student@ubuntu:~/piscine-go/strlenprog$ ./strlenprog "hello" "how are you" -student@ubuntu:~/piscine-go/strlenprog$ +student@ubuntu:~/piscine-go/test$ go build +student@ubuntu:~/piscine-go/test$ ./test +12 +student@ubuntu:~/piscine-go/test$ ``` diff --git a/subjects/unionEx.en.md b/subjects/union.en.md similarity index 89% rename from subjects/unionEx.en.md rename to subjects/union.en.md index 719e0a4b7..8b4e4583b 100644 --- a/subjects/unionEx.en.md +++ b/subjects/union.en.md @@ -6,7 +6,7 @@ Write a program that takes two `string` and displays, without doubles, the chara The display will be in the order characters appear in the command line, and will be followed by a newline (`'\n'`). -If the number of arguments is different from 2, the program displays newline (`'\n'`). +If the number of arguments is different from 2, then the program displays newline (`'\n'`). ### Usage