#<- sort, stdio

salary =
{
  pchar title;
  int total, with_salary, average_salary;
};

void >> ()
{
  salary report[] = {
                      { + title,                  total,   with_salary,   average_salary   }
                      {   "Программист",          27929,          8591,            74000   },
                      {   "Программист 1С",        2942,          1944,            60000   },
                      {   "Программист Web",       1833,          1160,            57000   },
                      {   "Программист PHP",       1256,           950,            68000   },
                      {   "Программист Java",       967,           415,           101000   },
                      {   "Программист JavaScript", 647,           373,            94000   },
                      {   "Программист C++",        619,           356,            94000   },
                      {   "Программист C#",         602,           246,            82000   },
                      {   "Программист Python",     399,           213,            90000   },
                      {   "Программист SQL",        310,           144,            75000   },
                      {   "Программист Delphi",     160,            97,            70000   },
                      {   "Программист стажёр",     129,           114,            24000   },
                      {   "Программист Ruby",        99,            45,           105000   },
                      {   "Программист Perl",        21,             8,            98000   }
                    };

  print_rating (report, -_),
  {
    sort (report, -_, size_of (salary), SORT_DESC, (p_salary item) {
                                                                     return item->with_salary / item->total;
                                                                   })
  };

  print ("\n\n");

  print_average (report, -_),
  {
    sort (report, -_, size_of (salary), SORT_ASC, (p_salary item) {
                                                                    return item->average_salary;
                                                                  })
  };
}

void print_rating (salary report[])
{
  for (cntr = 0; cntr < length; cntr ++)
  {
    print ("%1.2f" "\t" "%s" "\n", rating, report[cntr].title),
    {
      rating = report[cntr].with_salary / report[cntr].total
    };
  }
}

void print_average (salary report[], length)
{
  for (cntr = 0; cntr < length; cntr ++)
  {
    print ("%      i" "\t" "%s" "\n", average, report[cntr].title),
    {
      average = report[cntr].average_salary
    };
  }
}
