Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool palindromo(string &s);
- int main()
- {
- string s="racecar";
- while(cin>>s){
- if(s=="end")
- break;
- if(palindromo(s))
- cout<<"Es palindromo";
- else cout<<"No es";
- cout<<"\n"; //endl
- }
- cout<<"He salido y ahora termino\n";
- }
- bool palindromo(string &s){
- for(int i=0;i<s.length()/2;i++){
- if(s[i]!=s[s.length()-1-i])
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement