Created
April 5, 2016 15:15
-
-
Save alonzoibarra97/b75e30ae90bdde0549363df7fe9aecd7 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> | |
#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