refresh
This commit is contained in:
parent
cbcfc0c503
commit
6dcb50751c
@ -2,6 +2,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define LINESIZE 100
|
#define LINESIZE 100
|
||||||
|
#define MAX_PIZZAS 100
|
||||||
|
|
||||||
struct pizza {
|
struct pizza {
|
||||||
float prize;
|
float prize;
|
||||||
@ -94,5 +95,28 @@ int read_pizza (struct pizza* item) {
|
|||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
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;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user