This commit is contained in:
Oleksandr Vyshniakov 2025-09-27 19:54:37 +02:00
parent cbcfc0c503
commit 6dcb50751c

View File

@ -2,6 +2,7 @@
#include <ctype.h>
#include <string.h>
#define LINESIZE 100
#define MAX_PIZZAS 100
struct pizza {
float prize;
@ -94,5 +95,28 @@ int read_pizza (struct pizza* item) {
int main() {
return 0;
char poisk[LINESIZE];
printf("Zadaj hladanu surovinu:\n");
fgets(poisk, sizeof(poisk), stdin);
poisk[strcspn(poisk, "\n")] = '\0';
struct pizza jedalny_listok [MAX_PIZZAS];
int vsetky = 0;
while (vsetky<MAX_PIZZAS && read_pizza(&jedalny_listok[vsetky])) {
vsetky++;
}
int count = 0;
for (int i = 0; i < vsetky; i++) {
if (search_string(jedalny_listok[i].name, poisk)!= -1) {
printf("%s\n", jedalny_listok[i].name);
printf("%s\n", jedalny_listok[i].prize);
count++;
}
}
return 0;
}