Skip to content

Instantly share code, notes, and snippets.

@fernandoalv
Created April 17, 2015 20:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fernandoalv/e5b64e13d0700f916cf1 to your computer and use it in GitHub Desktop.
Save fernandoalv/e5b64e13d0700f916cf1 to your computer and use it in GitHub Desktop.
#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