программы на си++ к лабораторным в основном исходящим из одной

нужно до 10-11 января

мой вариант:

Предметная область:Техническое обслуживание (ТО) автомобилей

Структурный тип данных:

Транспортное средство (vehicle)

Элементы структуры:

ФИО владельца (owner)

Регистрационный номер (reg_number)

Тип автомобиля (type)

Марка автомобиля (brand)

Объем двигателя (volume)

Мощность двигателя (power)

Дата последнего ТО (last_to)

Пробег (mileage)

Задание:

1) Вывести на экран регистрационные номера всех автомобилей с пробегом свыше

100000 км.

2) Вывести на экран фамилии владельцев всех автомобилей, прошедших ТО в

течение последнего месяца.

мой код:

#include "pch.h"

#include

#include

#include

#include

#include

using namespace std;

struct vehicle

{

string owner;

int reg_number;

string type;

string brand;

int volume;

int power;

int last_to;

int mileage;

};

vehicle read_info(ifstream &file)

{

vehicle naruto;

getline(file, naruto.owner);

file >> naruto.reg_number;

getline(file, naruto.type);

getline(file, naruto.brand);

file >> naruto.volume;

file >> naruto.power;

file >> naruto.last_to;

file >> naruto.mileage;

file.get();

return naruto;

}

void print_info(vehicle naruto, int i)

{

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

}

void program_1(vehicle naruto[], int N)

{

for (int i = 0; i

if (naruto.mileage > 100000)

{

cout .reg_number

}

}

system("pause");

}

void program_2(vehicle naruto[], int N)

{

for (int i = 0; i

if (naruto.last_to >= 1201)

{

cout .owner

}

}

system("pause");

}

void menu()

{

cout

cout

cout

cout

cout

cout

cout

}

int N;

vehicle* naruto;

int main()

{

int  n;

ifstream infile;

infile.open("file.txt");

infile >> N;

infile.get();

naruto = new vehicle[N];

for (int i = 0; i

naruto = read_info(infile);

infile.close();

for (int i = 0; i

print_info(naruto, i);

menu();

do

{

cout

cout

cout

cin >> n;

cout

switch (n)

{

case 0: menu();

break;

case 1:

program_1(naruto, N);

break;

case 2:

program_2(naruto, N);

break;

default:

cout

}

} while (n != -1);

cout

delete[] naruto;

system("pause");

return 0;

}

4 года назад
guest_16099850938631
4 года в сервисе
Был
3 года назад

Выбранный исполнитель

Sarmat19
34 года
5 лет в сервисе
Был
3 года назад
4 года назад
$15
3 дня
Escrow
Выполнено хорошо и вовремя
Отличный клиент, задача поставлена четко. Рекомендую!

Заявки фрилансеров

Sarmat19
34 года
5 лет в сервисе
Был
3 года назад
4 года назад
Роман
 
37 лет
4 года в сервисе
Был
4 года назад
4 года назад