Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- FILE*fichier=NULL;
- fichier=fopen("français.txt","r");
- char motfr[20];
- int i;
- printf ("entrer un nombre entre 1 et 10 :\n");
- scanf ("%d",&i);
- int c;
- c=0;
- while (c!=i)
- {fgets (motfr,20,fichier);
- c++; }
- fclose (fichier);
- printf("%s",motfr);
- FILE*fichier2=NULL;
- fichier2=fopen("anglais.txt","r");
- char motAg[20];
- c=0;
- while (c!=i)
- {fgets (motAg,20,fichier);
- c++; }
- fclose (fichier2);
- char reponse[20];
- motAg[strcspn(motAg,"\r")]=0;
- int comp;
- int len;
- do {
- printf ("Traduit le mot suivant : %s",motfr);
- scanf("%s",reponse);
- comp=strcmp(motAg,reponse);
- len=strcspn(motAg,reponse);
- } while (comp!=0);
- printf ("Bravo\n");
- printf ("%d""\n",comp);
- printf ("%d",len);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement