#include #include #include typedef struct { char name[101]; double price; } Pizza; int comparePizzas(const void *a, const void *b) { Pizza *pizzaA = (Pizza *)a; Pizza *pizzaB = (Pizza *)b; if (pizzaA->price < pizzaB->price) { return -1; } else if (pizzaA->price > pizzaB->price) { return 1; } else { return strcmp(pizzaA->name, pizzaB->name); } } int main() { Pizza menu[] = { {"Salamovo Fazulova pizza", 7.96}, {"Sunkova pizza", 5.77}, {"Bryndzova pizza", 8.67}, {"Zelerova pizza", 8.86}, {"Slaninovo Sunkova pizza", 7.55}, {"Slaninova pizza", 5.16} }; int menuSize = sizeof(menu) / sizeof(menu[0]); qsort(menu, menuSize, sizeof(Pizza), comparePizzas); for (int i = 0; i < menuSize; i++) { printf("%s\n%.6f\n", menu[i].name, menu[i].price); } return 0; }