From 040eaf1a622c93446e6a93273e7bf2123ba042fa Mon Sep 17 00:00:00 2001 From: Rick Date: Mon, 14 Dec 2020 01:18:07 +0100 Subject: [PATCH] Modifications nomr variables --- jour2/main.c | 34 +++++++++++++++++----------------- turbo_main.c | 9 +++++---- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/jour2/main.c b/jour2/main.c index 1c23657..b995f66 100644 --- a/jour2/main.c +++ b/jour2/main.c @@ -1,59 +1,59 @@ #include #include -void deuxPartie(FILE *ptr) +void deux_partie(FILE *ptr) { - int bornInf, bornSup; + int born_inf, born_sup; int find = 0; - char speChar; + char spe_char; char word[256]; - fscanf(ptr, "%d-%d %c: %s", &bornInf, &bornSup, &speChar, word); + fscanf(ptr, "%d-%d %c: %s", &born_inf, &born_sup, &spe_char, word); while (!feof(ptr)) { - if ((word[bornInf - 1] == speChar && word[bornSup - 1] != speChar) - || (word[bornInf - 1] != speChar && word[bornSup - 1] == speChar)) + if ((word[born_inf - 1] == spe_char && word[born_sup - 1] != spe_char) + || (word[born_inf - 1] != spe_char && word[born_sup - 1] == spe_char)) { find++; } - fscanf(ptr, "%d-%d %c: %s", &bornInf, &bornSup, &speChar, word); + fscanf(ptr, "%d-%d %c: %s", &born_inf, &born_sup, &spe_char, word); } printf("%d bons mdp trouvés.\n", find); } -void premPartie(FILE *ptr) +void prem_partie(FILE *ptr) { - int bornInf, bornSup, i, nbOcc; + int born_inf, born_sup, i, nbOcc; int find = 0; - char speChar, readChar; + char spe_char, read_char; char word[256]; - fscanf(ptr, "%d-%d %c: %s", &bornInf, &bornSup, &speChar, word); + fscanf(ptr, "%d-%d %c: %s", &born_inf, &born_sup, &spe_char, word); while (!feof(ptr)) { i = 0; nbOcc = 0; - readChar = word[i]; - while (readChar != '\0') + read_char = word[i]; + while (read_char != '\0') { - if (readChar == speChar) + if (read_char == spe_char) { nbOcc++; } i++; - readChar = word[i]; + read_char = word[i]; } - if (nbOcc >= bornInf && nbOcc <= bornSup) + if (nbOcc >= born_inf && nbOcc <= born_sup) { find++; } - fscanf(ptr, "%d-%d %c: %s", &bornInf, &bornSup, &speChar, word); + fscanf(ptr, "%d-%d %c: %s", &born_inf, &born_sup, &spe_char, word); } printf("%d bons mdp trouvés.\n", find); diff --git a/turbo_main.c b/turbo_main.c index d0c3133..eb156d2 100644 --- a/turbo_main.c +++ b/turbo_main.c @@ -1,9 +1,10 @@ #include #define FILENAME "input" +//#define FILENAME "test" -void premPartie(FILE *ptr); -void deuxPartie(FILE *ptr); +void prem_partie(FILE *ptr); +void deux_partie(FILE *ptr); int main() { @@ -15,10 +16,10 @@ int main() } printf("Traitement de la première partie…\n"); - premPartie(ptr); + prem_partie(ptr); fseek(ptr, 0, SEEK_SET); printf("\nTraitement de la deuxième partie…\n"); - deuxPartie(ptr); + deux_partie(ptr); fclose(ptr); return 0;