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 46 47 48 49 50 51 52
|
nbResultats = 0;
//Rech par nom
printf("Entrer le nom du/des produit(s) recherch%c(s): ", 130);
fflush(stdin);
fgets(nom, 30, stdin);
printf("%s", nom);
//Premiere boucle pour recupérer le nombre de resultat
for(i = 0; i < nbJeux; i++)
{
if(strstr(liste[i].nom, nom))
{
nbResultats++;
}
}
printf("\n%d produit(s) trouv%c(s) \n\n", nbResultats, 130);
//Deuxieme boucle affichant les resultat en question
for(i = 0; i < nbJeux; i++)
{
if(strstr(liste[i].nom, nom))
{
textbackground(BLUE);
printf("Nom:");
textbackground(BLACK);
printf(" %s \n", liste[i].nom);
textbackground(BLUE);
printf("Cat%cgorie:", 130);
textbackground(BLACK);
afficherCategorie(liste[i].categorie);
textbackground(BLUE);
printf("Type:");
textbackground(BLACK);
afficherType(liste[i].type);
textbackground(BLUE);
printf("Marque:");
textbackground(BLACK);
printf(" %s \n", liste[i].marque);
textbackground(BLUE);
printf("Prix:");
textbackground(BLACK);
printf(" %f E\n", liste[i].prix);
textbackground(BLUE);
printf("Qt%c en stock:", 130);
textbackground(BLACK);
printf(" %d \n", liste[i].qteStock);
printf("\n\n");
system("pause");
system("cls");
}
} |
Partager