Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3.  
  4. using namespace std;
  5. int main()
  6. {
  7. int parzyste, liczba_znakow;
  8. string tekst;
  9. parzyste=0;
  10. ifstream dane("napisy.txt");
  11. ofstream odpowiedz;
  12. odpowiedz.open("zadanie4e.txt");
  13. if (dane.is_open())
  14. {
  15. while(dane.good())
  16. {
  17. getline(dane, tekst);
  18. liczba_znakow=tekst.size();
  19. if (liczba_znakow%2==0) parzyste++;
  20. }
  21. odpowiedz << "liczba parzystych wpisow wynosi "<< parzyste << "\n";
  22. }
  23. else cout << "\nBlad otwarcia pliku\n";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement