Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <fstream>
- using namespace std;
- //bool palindrom (string str)
- //{
- // int x;
- // x=str.size();
- // for (int i=0; i<(x/2); i++)
- // {
- // if (str[i]!=str[x-i-1]) return false;
- // }
- //}
- main ()
- {
- // int a;
- string str1, str2, s3,s4;
- // str2= "informatyka";
- // str1= "matematyka";
- // str2+=str1;
- // cout << str2 << endl;
- // str1=str1+" to krolowa nauk";
- // str1="matematyka"+"informatyka";
- // cout<<str1<<endl;
- // cout<<"Podaj lancuch"<<endl;
- // cin>>s3;
- // getline(cin,s3);
- // getline(cin,s4);
- // if (palindrom(s3)) cout <<"palindrom"<<endl;
- // else cout <<"nie palindrom"<< endl;
- // cout<<s3<<endl;
- // s4=s3;
- // cout<<" ma dlugosc "<< s3.size()<<endl;
- // cout<< "podaj ktora litere chcesz wyswietlic ";
- // cin>>a;
- // cout<<s3[a]<<endl;cout << s3<< endl;
- // reverse(s3.begin(),s3.end());
- // cout << s3<< endl;
- // cout << s4 << " "<<endl;
- // if (s3==s4) cout << "to Palindrom" << endl;
- // else cout << "nie jest palindromem" << endl;
- ifstream plik1;
- ofstream plik2;
- plik1.open( "andrei.txt");
- plik2.open( "wyniki.txt");
- if(!plik1.good())
- return false;
- while (!plik1.eof())
- {
- plik1 >>s3>>s4;
- getline(plik1,s3,' ');
- getline(plik1,s4);
- sort(s3.begin(),s3.end());
- sort(s4.begin(),s4.end());
- plik2 <<s3 <<" "<< s4<<endl;
- if (s3==s4) plik2 << "anagramy" << endl;
- else plik2 << " nie anagramy" << endl;
- }
- // cout << s3<< endl;
- plik1.close();
- plik2.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement