refresh
This commit is contained in:
parent
6dcb50751c
commit
01380c0ffc
Binary file not shown.
@ -84,7 +84,7 @@ int read_pizza (struct pizza* item) {
|
|||||||
}
|
}
|
||||||
Line_druha [strcspn(Line_druha, "\n")] = '\0';
|
Line_druha [strcspn(Line_druha, "\n")] = '\0';
|
||||||
float value;
|
float value;
|
||||||
if (sscanf(Line_jeden, "%f", &value ) !=1) {
|
if (sscanf(Line_druha, "%f", &value ) !=1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
item->prize = value;
|
item->prize = value;
|
||||||
@ -95,28 +95,29 @@ int read_pizza (struct pizza* item) {
|
|||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char poisk[LINESIZE];
|
char s_item[LINESIZE];
|
||||||
|
struct pizza menu[MAX_PIZZAS];
|
||||||
|
int pocet = 0;
|
||||||
|
|
||||||
printf("Zadaj hladanu surovinu:\n");
|
printf("Zadaj hladanu surovinu:\n");
|
||||||
fgets(poisk, sizeof(poisk), stdin);
|
fgets(s_item, sizeof(s_item), stdin);
|
||||||
|
s_item[strcspn(s_item, "\n")] = '\0';
|
||||||
|
|
||||||
poisk[strcspn(poisk, "\n")] = '\0';
|
|
||||||
|
|
||||||
struct pizza jedalny_listok [MAX_PIZZAS];
|
printf("Zadaj hlavny listok:\n");
|
||||||
|
|
||||||
int vsetky = 0;
|
while (pocet < MAX_PIZZAS && read_pizza(&menu[pocet])) {
|
||||||
while (vsetky<MAX_PIZZAS && read_pizza(&jedalny_listok[vsetky])) {
|
pocet++;
|
||||||
vsetky++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
for (int i = 0; i < pocet; i++) {
|
||||||
for (int i = 0; i < vsetky; i++) {
|
if (search_string(menu[i].name, s_item) !=-1) {
|
||||||
if (search_string(jedalny_listok[i].name, poisk)!= -1) {
|
printf("%s\n", menu[i].name);
|
||||||
printf("%s\n", jedalny_listok[i].name);
|
printf("%.2f\n", menu[i].prize);
|
||||||
printf("%s\n", jedalny_listok[i].prize);
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Nacitannych %s poloziek.\n", pocet);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user