This commit is contained in:
mr314ot 2025-10-07 11:41:48 +02:00
parent a19ffdbaf2
commit 13e500949d

View File

@ -31,7 +31,7 @@ int read_pizza(struct pizza *item) {
}
strcpy(item->name, line1);
item->prize = value;
item->price = value;
return 1;
}
@ -40,8 +40,8 @@ int compare_pizza(const void *a, const void *b){
const struct pizza *pa = (const struct pizza *)a;
const struct pizza *pb = (const struct pizza *)b;
if (pa->prize < pb->prize) return -1;
if (pa->prize > pb->prize) return 1;
if (pa->price < pb->price) return -1;
if (pa->price > pb->price) return 1;
return strcmp(pa->name, pb->name);
}
@ -62,7 +62,7 @@ int main() {
//vypis listka
for (int i = 0; i < count; i++){
printf("%s\n", list[i].name);
printf("%s\n", list[i].prize);
printf("%s\n", list[i].price);
}
return 0;