SHARE
TWEET

Untitled

a guest Oct 21st, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. bool sprawdz(string s1, string s2)
  6. {
  7.     int d1=s1.size()
  8.     if(d1!=s2.size())return false;
  9.     else
  10.     {
  11.         int T1[2]={0,0},T2[2]={0,0};
  12.         for (int i=0; i<d1:i++)
  13.         {
  14.             if(s1[i]=='X')T1[0]++;
  15.             else T1[1]++;
  16.             if(s2[i]=='X')T2[0]++;
  17.             else T2[1]++;
  18.         }
  19.         for(int i=0;i<2;i++)
  20.             if (T1[i]!=T2[i])return false;
  21.     }
  22.     return true;
  23. }
  24.  
  25. int main()
  26. {
  27.     string s1, s2;
  28.     cout<<"podaj pierwszy wyraz: ";
  29.     cin>>s1;
  30.     cour<<"podaj drugi wyraz: ";
  31.     cin>>s2;
  32.     if(sprawdz (s1,s2)) cout<<"\nslowa sa anagranami"<<endl;
  33.     else cout<<"\nslowa nie sa anagramami"<<endl;
  34.     //systen("pause")
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top