Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. bool sprawdz(string s)
  6. {
  7. int dl=s.size();
  8. for(int i=0;i<dl/2;i++)
  9. if(s[i]!=s[dl-i-1])return false;
  10. return true;
  11. }
  12. }
  13.  
  14. main()
  15. {
  16. string s;
  17. cout<<"podaj wyraZ: ";
  18. cin>>s;
  19. if (sprawdz(s)) cout<<"\nslowo" <<s<< "jest palindromem"<<endl;
  20. else cout<<"\nslowo"<<s<<"nie jeste palindorm"<<endl;
  21. //system("pause");
  22. return 0;
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement