Created
April 17, 2015 20:45
-
-
Save fernandoalv/e5b64e13d0700f916cf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
bool esPalindromo(string cadena, int size){ | |
for(int i = 0; i < size/2; i++) | |
if(cadena[i] != cadena[size-i-1]) | |
return false; | |
return true; | |
} | |
int main(){ | |
string cadena; | |
cout << "Ingresa la cadena: "; | |
cin>> cadena; | |
esPalindromo(cadena,cadena.length()) | |
? cout << "Es palindromo " : cerr << "No es palindromo"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment