Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- int policz(ifstream& dane);
- int main()
- {
- ifstream dane("NAPIS.TXT");
- string slowo;
- //cout << policz(dane);
- //string katalog[policz(dane)];
- string *katalog = new string [policz(dane)];
- for(int i=0; i<1000; i++)
- {
- dane >> slowo;
- katalog[i] = slowo;
- }
- for(int i=0; i<1000; i++)
- {
- string buffer = katalog[i];
- for(int j=i; j<1000; j++)
- {
- if(j!=i && katalog[i]==katalog[j]) cout << katalog[i] << endl;
- }
- }
- // for(int i=0; i<1000; i++)
- // {
- // cout << katalog[i] << endl;
- // }
- // cout << rosnie("ABB") << endl;
- // while(!dane.eof())
- // {
- //
- // }
- return 0;
- }
- int policz(ifstream& dane)
- {
- string slowo;
- int i=0;
- // dane >> slowo;
- // cout << slowo << endl;
- while(!dane.eof())
- {
- dane >> slowo;
- i++;
- }
- dane.seekg(0);
- return i;
- }
Add Comment
Please, Sign In to add comment