J'aimerais faire une programmation modulaire du ROT 13. J'ai code mais ça ne compile pas j'aimerais connaître l'erreur.
Voici mon main .c
Voici mon code essai.c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <stdio.h> #include <stdlib.h> #include <string.h> #include "essai.h" int main() { char text[5], crypter_txt[5],decrypter_txt[5]; printf("Enter le texte que l�on veut coder : \n"); scanf("%s",&text); strcpy(crypter_txt, crypte(text)); printf("\n Le texte code est : \n"); scanf("%s",crypter_txt); strcpy(decrypter_txt, decrypte(crypter_txt)); printf("\n\n Le texte decode est : \n"); scanf("%s",decrypter_txt); return 0; }
Et voici mon essai.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 #include <stdio.h> #include <stdlib.h> #include <string.h> #include "essai.h" char* crypter(char crypter_txt[]){ int i,n; char ch; for(i=0;i<strlen(crypter_txt);i++){ n=crypter_txt[i]; n=n+13; if(n>90){ n=n-90+64; ch=n; crypter_txt[i]=ch; }else{ ch=n; crypter_txt[i]=ch; } } return crypter_txt; } char* decrypter(char decrypter_txt[]){ int i,n; char ch; for(i=0;i<strlen(decrypter_txt);i++){ n=decrypter_txt[i]; n=n-13; if(n<65){ n=91-(65-n); ch=n; decrypter_txt[i]=ch; }else{ ch=n; decrypter_txt[i]=ch; } } return decrypter_txt; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 #ifndef ESSAI_H #define ESSAI_H char* decrypte(char decrypter_txt[]); char* crypte(char crypter_txt[]); #endif // ESSAI_H
Partager