Skip to content

Instantly share code, notes, and snippets.

@alonzoibarra97
Created April 5, 2016 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alonzoibarra97/b75e30ae90bdde0549363df7fe9aecd7 to your computer and use it in GitHub Desktop.
Save alonzoibarra97/b75e30ae90bdde0549363df7fe9aecd7 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
int i;
string cadena, cadena_inv;
int main () {
cout<< "Give me the string: \n";
getline(cin,cadena);
for( i= cadena.size()-1; i>=0; i--)
{
cadena_inv += cadena.at(i);
}
if(cadena==cadena_inv)
{
cout<<"This string is a palindrome";
}
else{
cout<<"This string is not a palindrome";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment