Advertisement
Guest User

Untitled

a guest
May 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <fstream>
  4. using namespace std;
  5. struct time
  6. {
  7. int hour;
  8. int min;
  9. int sec;
  10. };
  11. struct members
  12. {
  13. char shifr[5];
  14. char age_group;
  15. double weight;
  16. int growth;
  17. time finish;
  18. };
  19. bool faster80min(members a)
  20. {
  21. if (a.finish.hour > 11)
  22. return 0;
  23. else
  24. if (a.finish.hour == 11)
  25. if (a.finish.min < 20)
  26. return 1;
  27. else
  28. return 0;
  29. return 1;
  30. }
  31. int main()
  32. {
  33. ifstream in("input.txt");
  34. ofstream out("output.bin", ios::binary);
  35. int n;
  36. in >> n;
  37. members x;
  38. for (int i = 0; i < n; i++)
  39. {
  40. in >> x.shifr >> x.age_group >> x.weight >> x.growth;
  41. char* b = new char[8];
  42. in >> b;
  43. x.finish.hour = (int(b[0]) - 48) * 10 + int(b[1]) - 48;
  44. x.finish.min = (int(b[3]) - 48) * 10 + int(b[4]) - 48;
  45. x.finish.min = (int(b[6]) - 48) * 10 + int(b[7]) - 48;
  46. if (faster80min(x) && (x.age_group == 'A' || x.age_group == 'C'))
  47. out.write((char*)&x, sizeof(x));
  48. }
  49. cout << k;
  50. in.close();
  51. out.close();
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement