Advertisement
arturParchem

PalindromzodwruceniemCwicz4

Jun 3rd, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. bool czy_palindrom(string s) {
  5.     string pomoc=s;
  6.     int zwrot=1;
  7.     for(int i=0;i<s.size()/2+1;i++)
  8.         swap(pomoc[i],pomoc[s.size()-1-i]);
  9.     for(int i=0;i<s.size()/2+1;i++)
  10.         if(pomoc[i]!=s[i])
  11.             zwrot=0;
  12. return zwrot;
  13. }
  14. int main()
  15. {
  16.     cout<<czy_palindrom("aabbaa");
  17. }
  18.     // zdefiniuj funkcję i sprawdź jej działanie
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement