Следующая программа: include
#include <vector>
#include <istream>
#include <fstream>
#include <chrono>

struct Date {
int day;
int month;
int year;

Date(int d, int m, int y) : day(d), month(m), year(y) {}

bool operator>(const Date& other) const {
if (year > other.year) {
return true;
}
else if (year == other.year && month > other.month) {
return true;
}
else if (year == other.year && month == other.month && day > other.day) {
return true;
}
return false;
}

bool operator<(const Date& other) const {
return !(operator>(other) || operator==(other));
}

bool operator==(const Date& other) const {
return (year == other.year && month == other.month && day == other.day);
}
};

struct GroupNumber
{
char letter;
int number;

GroupNumber(char l, int n) : letter(l), number(n) {}

bool operator>(const GroupNumber& other) const
{
if (letter > other.letter)
{
return true;
}
else if (letter == other.letter && number > other.number)
{
return true;
}
return false;
}

bool operator<(const GroupNumber& other) const
{
return !(operator>(other) || operator==(other));
}

bool operator==(const GroupNumber& other) const
{
return (letter == other.letter && number == other.number);
}
};

struct Fio {
std::string surname;
std::string name;
std::string patronymic;

Fio(std::string s, std::string n, std::string p) : surname(s), name(n), patronymic§ {}

bool operator>(const Fio& other) const {
if (surname > other.surname) {
return true;
}
else if (surname == other.surname && name > other.name) {
return true;
}
else if (surname == other.surname && name == other.name && patronymic > other.patronymic) {
return true;
}
return false;
}

bool operator<(const Fio& other) const {
return !(operator>(other) || operator==(other));
}

bool operator==(const Fio& other) const {
return (surname == other.surname && name == other.name && patronymic == other.patronymic);
}
};

struct Sorts {
Fio fios;
GroupNumber groupNumbers;
int n;
Sorts(const Fio& f, const GroupNumber& g, int num) : fios(f), groupNumbers(g), n(num) {}
};


std::vector<Sorts> readFromFile(const std::string& filename) {
std::vector<Sorts> sorts;
std::ifstream file(filename);
int n = 0;

if (file.is_open()) {
std::string surname, name, patronymic;
char letter;
int number;

while (file >> surname >> name >> patronymic >> letter >> number) {
Fio fio(surname, name, patronymic);
GroupNumber groupNumber(letter, number);
sorts.push_back(Sorts(fio, groupNumber, n));
n += 1;
}

file.close();
}
else {
std::cerr << “Enable open file” << filename << std::endl;
}

return sorts;
}

int partOfQuickSort(std::vector<Sorts>& sorts, int start, int end)
{
int left = start;

for (int i = start; i < end; i++)
{
if (sorts[i].fios < sorts[end].fios || sorts[i].fios == sorts[end].fios || sorts[i].groupNumbers < sorts[end].groupNumbers || sorts[i].groupNumbers == sorts[end].groupNumbers)
{
Sorts temp = sorts[left];
sorts[left] = sorts[i];
sorts[i] = temp;
left++;
}
}
Sorts temp = sorts[left];
sorts[left] = sorts[end];
sorts[end] = temp;
return left;
}
void quickSort(std::vector<Sorts>& sorts, int start, int end)
{
if (start >= end) return;
int rightStart = partOfQuickSort(sorts, start, end);
quickSort(sorts, start, rightStart);
quickSort(sorts, rightStart + 1, end);
}
void quickSort(std::vector<Sorts>& sorts)
{
quickSort(sorts, 0, sorts.size());
}
double quickSortWithTime(std::vector<Sorts>& sorts)
{
double timeQuick;
auto start = std::chrono::high_resolution_clock::now();
quickSort(sorts);
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> duration = end - start;
timeQuick = duration.count();
return timeQuick;
}
void writeFileQuickSort(std::string readFile, std::string file)
{
std::vector <Sorts> sorts = readFromFile(readFile);
std::ofstream out(file);

double timeQuick = quickSortWithTime(sorts);
for (int i = 0; i < sorts.size(); i++) {
out << sorts[i].fios.surname << " " << sorts[i].fios.name << " " << sorts[i].fios.patronymic << " " << sorts[i].groupNumbers.letter << sorts[i].groupNumbers.number << std::endl;
}
out << “Time taken for QuickSort: " << timeQuick << " seconds” << std::endl;
}



int main()
{
writeFileQuickSort(“Shortr.txt”, “QuickSort.txt”);

} крашится на строке if (sorts[i].fios < sorts[end].fios || sorts[i].fios == sorts[end].fios || sorts[i].groupNumbers < sorts[end].groupNumbers || sorts[i].groupNumbers == sorts[end].groupNumbers). Почему?