#include <stdio.h>
#include <stdlib.h>

struct book
{
    char title[15];
    char author[15];
    int price;
    int pages;
};

void quicksort(struct book* mas, int first, int last)
{
    int f = first, l = last;
    int mid = mas[(f + l) / 2].price; //вычисление опорного элемента
    do
    {
        while (mas[f].price < mid) f++;
        while (mas[l].price > mid) l--;
        if (f <= l) //перестановка элементов
        {
            struct book count = mas[f];
            mas[f] = mas[l];
            mas[l] = count;
            f++;
            l--;
        }
    } while (f < l);
    if (first < l) quicksort(mas, first, l);
    if (f < last) quicksort(mas, f, last);
}

int main()
{
    struct book libry[5] = {
        { "Title 1", "Author1", 100, 200 },
        { "Title 2", "Author2", 900, 300 },
        { "Title 3", "Author3", 200, 400 },
        { "Title 4", "Author4", 800, 500 },
        { "Title 5", "Author5", 500, 600 }
    };

    quicksort(libry,0,4);

    for(int i = 0; i < 5; i++)
    {
        printf("\n %d. %s ", i + 1, libry[i].author);
        printf("%s %d %d", libry[i].title, libry[i].price, libry[i].pages);
    }
}
