допиши свой код
#include <iostream>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <fstream>

using namespace std;

struct date {
    int day;
    char *month;
    int year;
};

struct fio {
    char *name;
    char *surname;
    char *patronymic;
};

struct car {
    char *brand;
    fio owner;
    int engine_power;
    int mileage;
    date last_service;
};

void load_data(car *cars, int n, const string &file_name);
void add_car(car *cars, int &n);
void print_cars(const car *cars, int n);
void search_cars(const car *cars, int n, date current_date);
void find_brand(const car *cars, int n, const char *brand);
void sort_print_high_mileage(car *cars, int n, int mileage_limit);
void save_data(const car *cars, int n, const string &file_name);
void free_memory(car *cars, int n);

int main() {
    int n;
    cout << "Enter the number of cars: ";
    cin >> n;
    cin.ignore();

    car *cars = new car[n];

    load_data(cars, n, “cars_data.txt”);

    bool exit = false;
    while (!exit) {
        int choice;
        cout << “1. Add a new car” << endl;
        cout << “2. Print car information” << endl;
        cout << “3. Find cars with more than 18 months since last service” << endl;
        cout << “4. Find cars of a specified brand” << endl;
        cout << “5. Find owners with mileage greater than specified (sorted by alphabet)” << endl;
        cout << “6. Exit” << endl;
        cout << "Choose an action: ";
        cin >> choice;
        cin.ignore();

        time_t now = time(0);
        tm *ltm = localtime(&now);
        date current_date;
        current_date.day = ltm->tm_mday;
        current_date.month = new char[20];
        strcpy(current_date.month, “xx”);
        current_date.year = 1900 + ltm->tm_year;

        if (choice == 1) {
            cout << "Enter the number of new cars: ";
            int k;
            cin >> k;
            cin.ignore();
            car *new_cars = new car[k];
            add_car(new_cars, k);
            car *temp_cars = new car[n+k];
            memcpy(temp_cars, cars, n * sizeof(car));
            memcpy(temp_cars + n, new_cars, k * sizeof(car));
            n += k;
            delete[] cars;
            delete[] new_cars;
            cars = temp_cars;
        }
        else if (choice == 2) {
            print_cars(cars, n);
        }
        else if (choice == 3) {
            search_cars(cars, n, current_date);
        }
        else if (choice == 4) {
            char *brand = new char[20];
            cout << "Enter the brand to search for: ";
            gets(brand);
            find_brand(cars, n, brand);
            delete[] brand;
        }
        else if (choice == 5) {
            int mileage_limit;
            cout << "Enter the mileage limit: ";
            cin >> mileage_limit;
            cin.ignore();
            sort_print_high_mileage(cars, n, mileage_limit);
        }
        else {
            exit = true;
        }
    }

    save_data(cars, n, “cars_data.txt”);
    free_memory(cars, n);
    delete[] cars;
    delete[] current_date.month;

    return 0;
}

void load_data(car *cars, int n, const string &file_name) {
    ifstream input_file(file_name);
    if (!input_file.is_open()) {
        cerr << “Failed to open file for reading.” << endl;
        return;
    }

    for (int i = 0; i < n; i++) {
        cars[i].brand = new char[20];
        input_file.getline(cars[i].brand, 20);

        cars[i].owner.name = new char[20];
        input_file.getline(cars[i].owner.name, 20);

        cars[i].owner.surname = new char[20];
        input_file.getline(cars[i].owner.surname, 20);

        cars[i].owner.patronymic = new char[20];
        input_file.getline(cars[i].owner.patronymic, 20);

        input_file >> cars[i].engine_power;
        input_file >> cars[i].mileage;

        cars[i].last_service.day = 0;
        input_file >> cars[i].last_service.day;

        cars[i].last_service.month = new char[20];
        input_file.getline(cars[i].last_service.month, 20);

        cars[i].last_service.year = 0;
        input_file >> cars[i].last_service.year;

        input_file.ignore();
    }

    input_file.close();
}

void add_car(car *cars, int &n) {
    for (int i = 0; i < n; i++) {
        cout << "New car: " << endl;
        cout << "Brand: ";
        cars[i].brand = new char[20];
        gets(cars[i].brand);

        cout << "Owner’s name: ";
        cars[i].owner.name = new char[20];
        gets(cars[i].owner.name);

        cout << "Owner’s surname: ";
        cars[i].owner.surname = new char[20];
        gets(cars[i].owner.surname);

        cout << "Owner’s patronymic: ";
        cars[i].owner.patronymic = new char[20];
        gets(cars[i].owner.patronymic);

        cout << "Engine power: ";
        cin >> cars[i].engine_power;
        cin.ignore();

        cout << "Mileage: ";
        cin >> cars[i].mileage;
        cin.ignore();

        cout << "Last service date (day, month, year): ";
        cars[i].last_service.day = 0;
        cin >> cars[i].last_service.day;

        cars[i].last_service.month = new char[20];
        cin.ignore();
        gets(cars[i].last_service.month);

        cars[i].last_service.year = 0;
        cin >> cars[i].last_service.year;

        cout << endl;
    }
}

void print_cars(const car *cars, int n) {
    cout << "Car information: " << endl;
    for (int i = 0; i < n; i++) {
        cout << cars[i].brand << " | " << cars[i].owner.name << " | " << cars[i].owner.surname << " | " << cars[i].owner.patronymic
             << " | " << cars[i].engine_power << " | " << cars[i].mileage << " | " << cars[i].last_service.day << " " << cars[i].last_service.month << " " << cars[i].last_service.year << endl;
    }
    cout << endl;
}

void search_cars(const car *cars, int n, date current_date) {
    cout << "Cars that need service: " << endl;
    for (int i = 0; i < n; i++) {
        char *month_names[] = {“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”};
        int current_month_index = 0;
        int last_service_month_index = 0;

        for (int j = 0; j < 12; j++) {
            if (strcmp(current_date.month, month_names[j]) == 0) {
                current_month_index = j + 1;
            }
            if (strcmp(cars[i].last_service.month, month_names[j]) == 0) {
                last_service_month_index = j + 1;
            }
        }

        int months_since_last_service = (current_date.year - cars[i].last_service.year) * 12 + (current_month_index - last_service_month_index);
        if (months_since_last_service > 18) {
            cout << cars[i].brand << " | " << cars[i].owner.name << " | " << cars[i].owner.surname << " | " << cars[i].owner.patronymic
                 << " | " << cars[i].engine_power << " | " << cars[i].mileage << " | " << cars[i].last_service.day << " " << cars[i].last_service.month << " " << cars[i].last_service.year << endl;
        }
    }
    cout << endl;
}

void find_brand(const car *cars, int n, const char *brand) {
    cout << "Cars with the specified brand: " << endl;
    for (int i = 0; i < n; i++) {
        if (strcmp(cars[i].brand, brand) == 0) {
            cout << cars[i].brand << " | " << cars[i].owner.name << " | " << cars[i].owner.surname << " | " << cars[i].owner.patronymic
                 << " | " << cars[i].engine_power << " | " << cars[i].mileage << " | " << cars[i].last_service.day << "