Skip to content

Instantly share code, notes, and snippets.

@alonzoibarra97
Created May 3, 2016 17:08
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/76f310bc9eabe845241435cc65b7cbe1 to your computer and use it in GitHub Desktop.
Save alonzoibarra97/76f310bc9eabe845241435cc65b7cbe1 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
int i;
int main(){
string cadena, cadenain;
cout<<"Give one word and i will tell you if it is a palindrome or not\n";
getline(cin,cadena);
for(i= cadena.size()-1; i>=0; i--){
cadenain+= cadena.at(i);
}
if(cadena==cadenain)
{
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