From 6a0abffad2c60cef547c3cd28218efc3fe43cb56 Mon Sep 17 00:00:00 2001 From: SombrAbsol Date: Tue, 23 Jan 2024 16:05:38 +0100 Subject: [PATCH] Etape 1 --- a.exe | Bin 0 -> 30270 bytes etape1.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ etape2.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.c | 12 ---------- 4 files changed, 142 insertions(+), 12 deletions(-) create mode 100644 a.exe create mode 100644 etape1.c create mode 100644 etape2.c delete mode 100644 main.c diff --git a/a.exe b/a.exe new file mode 100644 index 0000000000000000000000000000000000000000..918a433c3a1919f7469d7e9b512a0df63c3ddb3b GIT binary patch literal 30270 zcmeHw3wRvWmFBH}s9KWcZuu#L!EGahow%iz)Gf)xhPEw13;Ym%fPo>U>h5ZF<9^W( zOC}JM7_#Vd$Z9uahRNqmoY~C8dF(91Fo|QBL>Lm144D8s%SSfDM46eeav&QgA2Trw z;Qi0NRoz|Hk}NVzcEk97x>fg_d+xdCoO|x0s_S0uxMhOb8DkE_bLSX4fjfl|zs`Lb zL-xW|Cl|6u>%YJHgtYzptM?|71#d2&9nPz1Z&b}>vPEx1^X5w#Z!+WU+qK7=&c?L1 zrly8go%LWpW3i7lvwQyLziaF|#?DBH>~hv z)EHyO=AdmWYNJKux76c8vXSo4qdE*RHq;hViz<*v3)M*0DqRR2Vr;T4F9<`F??)tE z79m!J5J=l1rDQ6Wj0Fh~1S9%oh*cp(bUDF~+X6P>bS+gxNOHPSL3bBr4IvW0ix8_q zi1E%}#k?6K^pnM4tT@TlQEhMZ*r|T<| z@I;8{dWC!*;^PG!$#)IUE?+`5HI%b1Bz{LN5I+3sy6^){4?_HDkDampj>(SaJH9*J zT9sZ`mEKTEhYvrs?li#@Rbl%B&M&$d>v$eaJz#p896lazbFaFWTjZqJGjI}WEk7ai&M-1a18qnxxE40*@HCj@*)K76uJEFByfJ#;7XzJ$C-!Vfrqa4D)CKZVrOJoUu% z-H-o(MdiHk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)55W4gj9QB+ed8XAk`)l?t1NKM7nNLr?{YJ?_UUYJ>Y^G&yQA@w*a=J0 z@zXf6aoP@t6ECPq@R@IIhQ4)_=kRTLN}&{iQxvtdqMzT#^GH->6dNmPKU5VaIRi$_ zA-Y5HU37FRB}6?0>)=qiRO%3RF{?3bAXO6BXeV5!Q}OeYCb93-*ty8-sX9(VSjt$m z&)GozJNtNPZd%Lvm^vHt36>R$K_oOs#bCsOZ|p>c+zPoWoil09%{ZE~LL!XNHlnEq z+R$=14pZT?N83yt1uwR;c?IXGRGS=!fzSzk3O`{pjb6bO8rZT|pQO*{pCq^0f4Eo9 zEZ9hT_w{><8}Tn26Z!0jQk+rDZPi}PTW*Fvz-o^B6fG+16}IPNMb+t|hS{QJ)r6(> z-JHVTOtn`Zn<{wDP_3!I&@mo@Qa@u=7e#DYRrrA%7F&}As}EikC5%NRvB5r8YqL=U z8NI~P{Ip1$hncBb{rN~N?964L#SFuV$sqKwXDMV61q3rTu`z7$PEb8Khz2RnrW$&- zxx$&bm&X=G4BloRppmcIP4p$JVQ8^gx4Mh)Q3SIcovlJnLd!F=7%*0~7l1o3`p{Ih z6&6+SE;#exC-Q2l=MQ!@)#<|pPS&-UoE`&bu!@xmJ~9K +#include + +/* Prend en parametre un entier et un entier a additionner */ +int indexcesar(int index, int cesar){ + index += cesar; + if(index > 25) + { + index -= 26; + } + return index; +} + +int main(int argc, char const *argv[]) +{ + int cesar = 13; + + /* Creation du tableau contenant toutes les lettres de l'alphabet */ + char alphabetMajuscule[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + char alphabetMinuscule[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; + + /* Creation d'un pointeur de fichier */ + FILE* stream = fopen("Etape2.bin","r"); + + /* S'il y a un probleme dans l'ouverture du fichier renvoie une erreur */ + if (ferror(stream)) + { + perror("Il y a un probleme dans l'ouverture du fichier !"); + return EXIT_FAILURE; + } + + /* Creation d'un pointeur de charactere qui alloue en memoire la taille d'un caractere*/ + char* zone_char = malloc(sizeof(char)); + + /* Tant qu'on atteint pas la fin du fichier */ + while(!feof(stream)) + { + /* lecture d'un caractere */ + if (fread(zone_char, sizeof(char), 1, stream) != 0) + { + /* Parcours du tableau pour retrouver la position du caractere*/ + int index = 0; + for (index; index <= 25; index++) + { + /* si le caractere est une majuscule */ + if (*zone_char == alphabetMajuscule[index]) + { + /* On rajoute le deplacement dans l'alphabet de cesar et on sort de la boucle */ + index = indexcesar(index, cesar); + printf("%c", alphabetMajuscule[index]); + break; + } + /* si le caractere est une minuscule */ + if (*zone_char == alphabetMinuscule[index]) + { + /* On rajoute le deplacement dans l'alphabet de cesar et on sort de la boucle */ + index = indexcesar(index, cesar); + printf("%c", alphabetMinuscule[index]); + break; + } + } + /* si la boucle ne s'est jamais arretee, alors ce n'est pas une lettre sinon c'est une lettre et on montre sa nouvelle valeur */ + if (index == 26) { + printf("%c", *zone_char); + } + } + } + fclose(stream); + free(zone_char); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/etape2.c b/etape2.c new file mode 100644 index 0000000..f95ac14 --- /dev/null +++ b/etape2.c @@ -0,0 +1,71 @@ +#include +#include + +/* Prend en parametre un entier et un entier a additionner */ +int indexcesar(int index, int cesar){ + index += cesar; + if(index > 25) + { + index -= 26; + } + return index; +} + +int main(int argc, char const *argv[]) +{ + int cesar = 1; + + /* Creation du tableau contenant toutes les lettres de l'alphabet */ + char alphabetMajuscule[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + char alphabetMinuscule[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; + + /* Creation d'un pointeur de fichier */ + FILE* stream = fopen("Etape2.bin","r"); + + /* S'il y a un probleme dans l'ouverture du fichier renvoie une erreur */ + if (ferror(stream)) + { + perror("Il y a un probleme dans l'ouverture du fichier !"); + return EXIT_FAILURE; + } + + /* Creation d'un pointeur de charactere qui alloue en memoire la taille d'un caractere*/ + char* zone_char = malloc(sizeof(char)); + + /* Tant qu'on atteint pas la fin du fichier */ + while(!feof(stream)) + { + /* lecture d'un caractere */ + if (fread(zone_char, sizeof(char), 1, stream) != 0) + { + /* Parcours du tableau pour retrouver la position du caractere*/ + int index = 0; + for (index; index <= 25; index++) + { + /* si le caractere est une majuscule */ + if (*zone_char == alphabetMajuscule[index]) + { + /* On rajoute le deplacement dans l'alphabet de cesar et on sort de la boucle */ + index = indexcesar(index, cesar); + printf("%c", alphabetMajuscule[index]); + break; + } + /* si le caractere est une minuscule */ + if (*zone_char == alphabetMinuscule[index]) + { + /* On rajoute le deplacement dans l'alphabet de cesar et on sort de la boucle */ + index = indexcesar(index, cesar); + printf("%c", alphabetMinuscule[index]); + break; + } + } + /* si la boucle ne s'est jamais arretee, alors ce n'est pas une lettre sinon c'est une lettre et on montre sa nouvelle valeur */ + if (index == 26) { + printf("%c", *zone_char); + } + } + } + fclose(stream); + free(zone_char); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/main.c b/main.c deleted file mode 100644 index 964355b..0000000 --- a/main.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char const *argv[]) -{ - /* creation du tableau contenant toutes les lettres de l'alphabet */ - char alphabet[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','T','U','V','X','Y','Z'}; - - FILE* - - return EXIT_SUCCESS; -} \ No newline at end of file