Скачиваний:
0
Добавлен:
04.01.2025
Размер:
2.05 Кб
Скачать
#include iostream
#include string
#include locale.h
using namespace std;

struct thing {
	string name;
	string manufacturer;
	int year;
	int amount;
	int cost;
};
int main()
{
	setlocale(LC_ALL, );
	const int M = 9;
	thing thing[M];
	thing[0].name = ручка;
	thing[0].manufacturer = Stabilo;
	thing[0].year = 2015;
	thing[0].amount = 1000000;
	thing[0].cost = 30;
	thing[1].name = тетрадь;
	thing[1].manufacturer = Stabilo;
	thing[1].year = 2022;
	thing[1].amount = 200000;
	thing[1].cost = 50;
	thing[2].name = карандаш;
	thing[2].manufacturer = Стамм;
	thing[2].year = 2022;
	thing[2].amount = 500000;
	thing[2].cost = 25;
	thing[3].name = ластик;
	thing[3].manufacturer = Stabilo;
	thing[3].year = 2022;
	thing[3].amount = 50000;
	thing[3].cost = 10;
	thing[4].name = пенал;
	thing[4].manufacturer = Хатбер;
	thing[4].year = 2017;
	thing[4].amount = 100000;
	thing[4].cost = 300;
	thing[5].name = линейка;
	thing[5].manufacturer = Стамм;
	thing[5].year = 2019;
	thing[5].amount = 150000;
	thing[5].cost = 23;
	thing[6].name = точилка;
	thing[6].manufacturer = Эксмо;
	thing[6].year = 2021;
	thing[6].amount = 150000;
	thing[6].cost = 30;
	thing[7].name = циркуль;
	thing[7].manufacturer = Stabilo;
	thing[7].year = 2015;
	thing[7].amount = 20000;
	thing[7].cost = 200;
	thing[8].name = магнит;
	thing[8].manufacturer = Stabilo;
	thing[8].year = 2022;
	thing[8].amount = 1000000;
	thing[8].cost = 30;
	int summ = 0,year =2022;
	for (int i = 0; i  M; i++) 
		if (thing[i].year == year) {
			summ += thing[i].amount  thing[i].cost;
			cout  Наименование   thing[i].name  endl  Изготовитель   thing[i].manufacturer  endl  Год выпуска   thing[i].year  endl  Количество   thing[i].amount  endl  Цена   thing[i].costendl;
		}
	if (summ == 0) cout  В этом году ничего не выпускали;
	cout  Общая сумма товаров   summ;
}
Соседние файлы в папке Практика 4