du2 - 3
This commit is contained in:
parent
a19ffdbaf2
commit
13e500949d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user