Advertisement
lekyy

Untitled

May 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <string>
  2. using namespace std;
  3.  
  4. int main()
  5.  
  6. {
  7. string c;
  8. int a = 0;
  9. int i = 3;
  10. int hellomrs = 0;
  11. int hellomr = 0;
  12. string hu;
  13. ifstream f;
  14. f.open("RC_in.txt");
  15. f >> c;
  16. while (!f.fail())
  17. {
  18. int zabodkou = c.find(' ');
  19. string ha = c.substr(0,zabodkou);
  20. hu = c.substr(zabodkou+1);
  21. int pozicia = hu.find(2);
  22. string he = hu.substr(2,1);
  23. if ( i % 3 == 0)
  24. {
  25. if ( stoi(he) > 4 )
  26. {
  27. hellomrs++;
  28. }
  29. if ( stoi(he) <5 )
  30. {
  31. hellomr++;
  32. }
  33. }
  34.  
  35. f >> c;
  36. i++;
  37. }
  38. cout << "Pocet dievcat: " << hellomrs << endl;
  39. cout << "Pocet chlapcov: " << hellomr << endl;
  40. system("pause");
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement