Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- int main(int argc, char *argv[])
- {
- FILE* fichier = NULL;
- char pioche[100] = "AAAAAAAAABBCCDDDEEEEEEEEEEEEEEEFFGGHHIIIIIIIIJKLLLLLMMMNNNNNNOOOOOOPPQRRRRRRSSSSSSTTTTTTUUUUUUVVWXYZ";
- char tirage[15];
- size_t len = strlen(tirage);
- char newt[15];
- char mot[16];
- char *ptr_pos;
- int i,j;
- for (j=0; j < 10; j++) {
- srand(time(NULL));
- int alea = rand() % strlen(pioche);
- tirage[j] = pioche[alea];
- }
- tirage[10] = '\0';
- printf("%s\n", tirage);
- fichier = fopen("/home/kiange/public_html/bac/ODS5.txt", "r");
- if (fichier != NULL)
- {
- while (fgets(mot, 20, fichier) != NULL)
- {
- size_t len_mot = strlen(mot) - 1;
- if (len_mot <= len)
- {
- strcpy(newt,tirage);
- for (i = 0; i < len_mot; i++)
- {
- ptr_pos = strchr(newt,mot[i]);
- if (ptr_pos != NULL)
- newt[ptr_pos - newt] = '-';
- else
- break;
- }
- if (i == len_mot) {}
- //printf ("%s", mot);
- }
- }
- fclose(fichier);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement