Advertisement
Guest User

anagram

a guest
Feb 19th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5. void sortString(string &x)
  6. {
  7.     sort(x.begin(),x.end());
  8. }
  9. int main()
  10. {
  11.     int n;
  12.     cout<<"ile prob? "<<endl;
  13. cin>>n;
  14. for (int m=0;m<n;m++)
  15. {
  16.     string a,b;
  17.     cout<<"podaj 1 slowo "<<endl;
  18.     cin>>a;
  19.     cout<<"podaj 2 slowo "<<endl;
  20.     cin>>b;
  21.     sortString(a);
  22.     sortString(b);
  23.     if (a==b)
  24.     {
  25.         cout<<"sa anagramami"<<endl;
  26.     }
  27.     else{cout<<"nie sa anagramami"<<endl;}
  28. }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement