Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string.h>
- #include <conio.h>
- #include <stdio.h>
- #include <Windows.h>
- #include <math.h>
- #define N 1000
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- {SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- }
- while (1)
- {
- struct automobile
- {
- //int nom;
- char mark[25];
- char color[15];
- int st;
- int mt;
- int ms;
- }auto[N];
- int i, k = 0, n;
- char str[20], otv;
- printf("Введите кол-во машин");
- scanf_s("%d", &n);
- printf("\n\t Введите данные о машинах\n");
- for (i = 0; i < n; i++)
- {
- printf("--------------------------------------");
- printf("Введите марку %d-й машины\n");
- cin >> aut[i].mark;
- printf("Введите цвет %d-й машины\n");
- cin >> aut[i].color;
- printf("Введите стоимость %d-й машины \n");
- cin >> aut[i].st;
- printf("Введите кол-во мест %d-й машины \n");
- cin >> aut[i].mt;
- printf("Введите максимальную скорость %d-й машины \n");
- cin >> aut[i].ms;
- }
- printf("Данные о всех машинах\n\n");
- for (i = 0; i < n; i++)
- {
- printf("%s", aut[i].mark" ");
- printf("%s", aut[i].color" ");
- printf("%d", aut[i].st" ");
- printf("%d", aut[i].mt" ");
- printf("%d", aut[i].ms" ");
- }
- printf("Надите чётное кол-во мест в авто");
- printf("\n");
- for (i = 0; i < n; i++)
- if (strcmp(str, aut[i].mt % 2)== 0)
- {
- printf("%s", aut[i].mark" ");
- printf("%s", aut[i].color" ");
- printf("%d", aut[i].st" ");
- printf("%d", aut[i].mt" ");
- printf("%d", aut[i].ms" ");
- k++;
- }
- if (k = 0) printf("Нет машин с чётным кол-вом дверей");
- _getch();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement