Created
April 19, 2016 16:20
-
-
Save DiegoNaterasPonce/fa1eb322e28ac80b99e5e8c8bf10b642 to your computer and use it in GitHub Desktop.
#WSQ13 Exam2 Prog4
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