#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
struct par
{
char dr[6];
int Speed;
};
struct transport
{
char name[20];
char brand[20];
int Height;
struct par r;
};
int main()
{
system("chcp 1251");
system("cls");
struct transport mas[5];
int temp;
char temps2[20];
int N;
for (int j = 0; j < 3; j++)
{
printf("%d: \n", j + 1);
printf(" %7s ", "Название самолёта:");
scanf("%s", &mas[j].name);
printf(" %7s ", "Марка:");
scanf("%s", &mas[j].brand);
printf(" %7s ", "Турбулентность в небе:");
scanf("%s", &mas[j].r.dr);
printf(" %7s ", "Скорость в км/ч:");
scanf("%d", &N);
mas[j].r.Speed = N;
printf(" %7s ", "Высота в км:");
scanf("%d", &N);
mas[j].Height = N;
printf("\n");
}
printf(" %15s", "Название"); printf(" %10s", "Марка");
printf(" %15s", "Турбулентность"); printf(" %10s", "Скорость"); printf("%15s\n", "Высота");
for (int j = 0; j < 3; j++)
{
printf(" %15s", mas[j].name);
printf(" %6s", mas[j].brand);
printf(" %15s", mas[j].r.dr);
printf(" %10d", mas[j].r.Speed);
printf(" %15d", mas[j].Height);
printf("\n");
}
printf("\n\n\n");
temp = mas[0].Height;
mas[0].Height = mas[2].Height;
mas[2].Height = temp;
temp = mas[0].r.Speed;
mas[0].r.Speed = mas[2].r.Speed;
mas[2].r.Speed = temp;
strncpy(temps2, mas[0].name, 20);
strncpy(mas[0].name, mas[2].name, 20);
strncpy(mas[2].name, temps2, 20);
strncpy(temps2, mas[0].brand, 20);
strncpy(mas[0].brand, mas[2].brand, 20);
strncpy(mas[2].brand, temps2, 20);
strncpy(temps2, mas[0].r.dr, 6);
strncpy(mas[0].r.dr, mas[2].r.dr, 6);
strncpy(mas[2].r.dr, temps2, 20);
printf(" %15s", "Название"); printf(" %10s", "Марка");
printf(" %15s", "Турбулентность"); printf(" %10s", "Скорость"); printf("%15s\n", "Высота");
for (int j = 0; j < 3; j++)
{
printf(" %15s", mas[j].name);
printf(" %6s", mas[j].brand);
printf(" %15s", mas[j].r.dr);
printf(" %10d", mas[j].r.Speed);
printf(" %15d", mas[j].Height);
printf("\n");
}
return 0;
}