Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- using namespace std;
- int main()
- {
- string c;
- int a = 0;
- int i = 3;
- int hellomrs = 0;
- int hellomr = 0;
- string hu;
- ifstream f;
- f.open("RC_in.txt");
- f >> c;
- while (!f.fail())
- {
- int zabodkou = c.find(' ');
- string ha = c.substr(0,zabodkou);
- hu = c.substr(zabodkou+1);
- int pozicia = hu.find(2);
- string he = hu.substr(2,1);
- if ( i % 3 == 0)
- {
- if ( stoi(he) > 4 )
- {
- hellomrs++;
- }
- if ( stoi(he) <5 )
- {
- hellomr++;
- }
- }
- f >> c;
- i++;
- }
- cout << "Pocet dievcat: " << hellomrs << endl;
- cout << "Pocet chlapcov: " << hellomr << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement