This commit is contained in:
Bohdan Kapliuk 2024-09-30 21:44:13 +03:00
parent c91b22ad4d
commit fc4437c6bd

View File

@ -18,6 +18,7 @@ int main(){
char letters[] = "oizeasbtbq"; char letters[] = "oizeasbtbq";
printf("Zadaj hladanu surovinu:\n"); printf("Zadaj hladanu surovinu:\n");
fgets(surovina,LINESIZE,stdin); fgets(surovina,LINESIZE,stdin);
surovina[strcspn(surovina, "\n")] = '\0';
printf("Zadaj jedalny listok:\n"); printf("Zadaj jedalny listok:\n");
int count = 0; int count = 0;
while (count < LINESIZE) { while (count < LINESIZE) {
@ -56,16 +57,10 @@ int main(){
} }
} }
} }
int ddfd = strcspn(menu[1].name, " "); char *istr;
for(int i = 0; i <= count;i++){ for(int i = 0; i <= count;i++){
int y = 0; istr = strstr(menu[i].name, surovina);
for(int x = 0; x <= strlen(surovina);x++){ if(istr != NULL){
if(surovina[x] != menu[i].name[x] && surovina[x] != menu[i].name[(strcspn(menu[i].name, " ") + x)+1]){
break;
}
y = 1;
}
if(y == 1){
printf("%s\n", menu1[i].name); printf("%s\n", menu1[i].name);
float number = strtof(menu1[i].price, NULL); float number = strtof(menu1[i].price, NULL);
printf("%.2f\n", number); printf("%.2f\n", number);