Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int pomoc=0;
- string slowo, odmiana;
- cout << "Podaj slowo(z malej litery)" << endl;
- cin>>odmiana;
- slowo = odmiana;
- int d = odmiana.size();
- for(int i=0;i<d/2;i++)
- {
- swap(odmiana[i],odmiana[d-i-1] );
- }
- for(int i=0;i<d;i++)
- {
- if(odmiana[i]==slowo[i])
- {
- pomoc++;
- }
- }
- if(d/2!=pomoc)
- {
- cout<<"To jest palindrom";
- }else
- cout<<"To nie jest palindrom";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement