Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- using namespace std;
- void a(){
- ifstream dane("slowa.txt");
- ofstream wynik("zad5a.txt");
- if(!dane) cout<<"blad odczytu z pliku";
- char slowo[13]; int licznik=0; int dl;
- int t[13]={0};
- // while(!dane.eof())
- // {dane>>slowo;
- while(dane>>slowo)
- {dl=strlen(slowo);
- t[dl]++;
- // cout<<slowo<<endl;
- licznik++;
- }
- cout<<endl<<"odczytano "<<licznik<<" slow"<<endl;
- for(int i=1;i<=12;i++)
- wynik<<"slow"<<i<<"literowych jest"<<t[i]<<endl;
- dane.close();
- wynik.close();
- }
- int main(int argc, char *argv[])
- { a();
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement