Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. fstream plik;
  10. long long pesel;
  11. long long liczba;
  12. int kobiety=0;
  13. int faceci=0;
  14. plik.open("dane.txt",ios::in);
  15. while(!plik.eof())
  16. {
  17. plik>>pesel;
  18. pesel/=10;
  19. liczba=pesel%10;
  20. if(liczba%2==0)
  21. kobiety=kobiety+1;
  22. else
  23. faceci=faceci+1;
  24.  
  25. }
  26. cout<<"kobiety "<<kobiety<<endl;
  27. cout<<"mezczyzni "<<faceci;
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement