Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. daca cuvintele sunt anagrame sau nu
  2. re c0t3y
  3.  
  4.  
  5.  
  6.  
  7. #include <iostream>
  8. #include <cstring>
  9. using namespace std;
  10. char s[21], x[21];
  11. int n,m;
  12. void ordonare(char s[21], int n)
  13. {
  14. char aux;
  15. for (int i=0; i<n-1;i++)
  16. for (int j=i+1; j<n;j++)
  17. if (s[i]>s[j])
  18. {
  19. aux=s[i];
  20. s[i]=s[j];
  21. s[j]=aux;
  22. }
  23. }
  24. int main()
  25. {
  26. cin >> s >> x;
  27. n=strlen(s);
  28. m=strlen(x);
  29. if(n==m)
  30. {
  31. ordonare(s,n);
  32. ordonare(x,m);
  33. if (strcmp(s,x)==0)
  34. cout << "da";
  35. else
  36. cout << "nu";
  37.  
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement