Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <windows.h>
- using namespace std;
- struct uch
- {
- string fio;
- string data;
- string mesyc;
- string god;
- };
- int main()
- {
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- setlocale(LC_ALL,"");
- ifstream fin("data.txt");
- ofstream fout("result.txt");
- uch a[5];
- int k = 0;
- string m;
- for(int i = 0; i < 5; i++)
- {
- getline(fin,a[i].fio);
- getline(fin,a[i].data);
- getline(fin,a[i].mesyc);
- getline(fin,a[i].god);
- }
- cin >> m;
- for(int i = 0; i < 5; i++)
- {
- if (a[i].god == m)
- {
- fout << a[i].fio << "\n";
- fout << a[i].data << "\n";
- fout << a[i].mesyc << "\n";
- fout << a[i].god << "\n";
- k++;
- }
- }
- cout << k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement