Advertisement
mercMatvey4

Untitled

Apr 8th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. #include <windows.h>
  5. using namespace std;
  6.  
  7. struct uch
  8. {
  9. string fio;
  10. string data;
  11. string mesyc;
  12. string god;
  13. };
  14.  
  15. int main()
  16. {
  17. SetConsoleOutputCP(1251);
  18. SetConsoleCP(1251);
  19. setlocale(LC_ALL,"");
  20. ifstream fin("data.txt");
  21. ofstream fout("result.txt");
  22. uch a[5];
  23. int k = 0;
  24. string m;
  25. for(int i = 0; i < 5; i++)
  26. {
  27. getline(fin,a[i].fio);
  28. getline(fin,a[i].data);
  29. getline(fin,a[i].mesyc);
  30. getline(fin,a[i].god);
  31. }
  32. cin >> m;
  33. for(int i = 0; i < 5; i++)
  34. {
  35. if (a[i].god == m)
  36. {
  37. fout << a[i].fio << "\n";
  38. fout << a[i].data << "\n";
  39. fout << a[i].mesyc << "\n";
  40. fout << a[i].god << "\n";
  41. k++;
  42. }
  43. }
  44. cout << k;
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement