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
|
void recherche_motcle(motcle *tmotcle[],int nbmotcle){
char tmp[1000],save[1000];
char m1[255];
char m2[255];
char mode[3];
printf("Entrer les mots cles recherches (motcle | motcle1 et motcle2 | motcle1 ou motcle2\n\n");
//scanf("%s",tmp);
fgets(tmp, sizeof(tmp),stdin);
strcpy(save,tmp);
strcpy(m1,strtok(tmp," "));
if(strcmp(m1,save) == 0){
printf("\nRecherche Simple\n\n");
recherche_motcle2(tmotcle,nbmotcle,m1,NULL,' ');
}
else{
strcpy(mode,strtok(NULL," "));
strcpy(m2,strtok(NULL," "));
printf("\nRecherche Composee\n\n");
if(strcmp(mode,"et") == 0){
recherche_motcle2(tmotcle,nbmotcle,m1,m2,' ');
}
else
if(strcmp(mode,"ou") == 0){
recherche_motcle2(tmotcle,nbmotcle,m1,m2,'u');
}
else{
printf("Operation non conforme\n");
}
}
} |
Partager