Skip to content

Instantly share code, notes, and snippets.

@DiegoNaterasPonce
Created March 9, 2016 01:48
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 DiegoNaterasPonce/2149b059d06bac902323 to your computer and use it in GitHub Desktop.
Save DiegoNaterasPonce/2149b059d06bac902323 to your computer and use it in GitHub Desktop.
#Quiz5
#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