This commit is contained in:
Bohdan Kapliuk 2024-09-30 20:34:13 +03:00
parent b62aa24115
commit 10398ec2b6

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#define LINESIZE 100 #define LINESIZE 100
struct pizza { struct pizza {
@ -51,23 +52,19 @@ int main(){
} }
} }
} }
int odpoved = -1; for(int i = 0; i <= count;i++){
for(int i = 0; i <= count && odpoved == -1;i++){ int y = 0;
for(int j = 0; j <= strlen(menu[i].name);j++){
for(int x = 0; x <= strlen(surovina);x++){ for(int x = 0; x <= strlen(surovina);x++){
if(surovina[x] != menu[i].name[j]){ if(surovina[x] != menu[i].name[x]){
break; break;
} }
odpoved = i; y = 1;
}
if(y == 1){
printf("%s\n", menu1[i].name);
float number = strtof(menu1[i].price, NULL);
printf("%.2f\n", number);
} }
}
}
if(odpoved == -1){
printf("chyba");
}
else{
printf("%s\n", menu1[odpoved].name);
printf("%s\n", menu1[odpoved].price);
} }
printf("Nacitanych %d poloziek.\n", count); printf("Nacitanych %d poloziek.\n", count);
return 0; return 0;