Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdlib.h>
- #include <string>
- #include <vector>
- using namespace std;
- struct Shoes {
- string name;
- string season;
- string producer;
- int price;
- int year;
- };
- int main() {
- setlocale(LC_ALL, "Russian");
- vector<Shoes> shoesVector;
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- while (!fin.eof()) {
- Shoes shoes;
- fin >> shoes.name >> shoes.season >> shoes.producer >> shoes.price >> shoes.year;
- shoesVector.push_back(shoes);
- }
- int totalAmount = 0;
- for (int i = 0; i < shoesVector.size(); i++) {
- Shoes currentShoes = shoesVector[i];
- if (currentShoes.year > 2014) {
- totalAmount += currentShoes.price;
- fout << currentShoes.name << ' ' << currentShoes.season << ' '
- << currentShoes.producer << ' ' << currentShoes.price
- << ' ' << currentShoes.year << '\n';
- }
- }
- fout << "Общая цена: " << totalAmount;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement