Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <fstream>
  4. using namespace std;
  5. void a(){
  6. ifstream dane("slowa.txt");
  7. ofstream wynik("zad5a.txt");
  8. if(!dane) cout<<"blad odczytu z pliku";
  9. char slowo[13]; int licznik=0; int dl;
  10. int t[13]={0};
  11. // while(!dane.eof())
  12. // {dane>>slowo;
  13. while(dane>>slowo)
  14. {dl=strlen(slowo);
  15. t[dl]++;
  16. // cout<<slowo<<endl;
  17. licznik++;
  18. }
  19. cout<<endl<<"odczytano "<<licznik<<" slow"<<endl;
  20. for(int i=1;i<=12;i++)
  21. wynik<<"slow"<<i<<"literowych jest"<<t[i]<<endl;
  22. dane.close();
  23. wynik.close();
  24. }
  25. int main(int argc, char *argv[])
  26. { a();
  27. system("PAUSE");
  28. return EXIT_SUCCESS;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement