Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3.  
  4. using namespace std;
  5. int main()
  6. {
  7. fstream zadanie4, napisy;
  8. int parzyste=0, ilosc_znakow;
  9. string tekst;
  10. zadanie4.open("zadanie4.txt",ios::out);
  11. napisy.open("napisy.txt",ios::in);
  12. if(napisy.good())
  13. {
  14. cout << "uzyskano dostep" << endl;
  15. while(napisy.good())
  16. {
  17. getline(napisy, tekst);
  18. ilosc_znakow=tekst.size();
  19. if (ilosc_znakow%2==0) parzyste++;
  20. }
  21. zadanie4 << "a) liczba parzystych wpisow wynosi: "<< parzyste <<endl;
  22. }
  23. else cout << "Blad!";
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement