Created
March 9, 2016 01:48
-
-
Save DiegoNaterasPonce/2149b059d06bac902323 to your computer and use it in GitHub Desktop.
#Quiz5
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 <iomanip> | |
#include <string> | |
using namespace std; | |
string word, fin; | |
string is_palindrome(string word) | |
{ | |
string backwards; | |
cout << "Tell me a word please: \n"; | |
cin >> word; | |
int large = word.length(); | |
for (int x = large - 1; x >= 0; x--) | |
{ | |
backwards += word[x]; | |
} | |
if (backwards == word) | |
{ | |
fin = "Your word is a palindrome"; | |
} | |
else | |
fin = "Your word is not a palindrome"; | |
return fin; | |
} | |
int main() | |
{ | |
cout << is_palindrome(fin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment