This commit is contained in:
mr314ot 2025-10-09 19:18:23 +02:00
parent 19ef0dec39
commit 0e32584893

View File

@ -30,11 +30,12 @@ int read_pizza(struct pizza *item) {
return 0; return 0;
} }
line2[strcspn(line2, "\n")] = '\0'; line2[strcspn(line2, "\n")] = '\0';
float value;
if (sscanf(line2, "%f", &value) != 1) { if (sscanf(line2, "%f", &value) != 1) {
return 0; return 0;
} }
strncpy(item->name, line1, LINESIZE - 1); strncpy(item->name, line1, LINESIZE - 1);
item->name[LINESIZE - 1] = '\0'; item->name[LINESIZE - 1] = '\0';
return 1; return 1;
@ -75,13 +76,12 @@ int main() {
list[count++] = tmp; list[count++] = tmp;
} }
//triedenie if (count > 0) {
sort_pizzas(list, count); sort_pizzas(list, count);
for (int i = 0; i < count; i++){
//vypis listka printf("%s\n", list[i].name);
for (int i = 0; i < count; i++){ printf("%.6f\n", list[i].price);
printf("%s\n", list[i].name); }
printf("%.6f\n", list[i].price);
} }
return 0; return 0;