Advertisement
Guest User

Untitled

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