Trouble reversing sentence

I need to write a program that figures out if a sentence is a palindrome or not.
I was able to get the program to take a sentence and compress it to one word that is lower case, but do not know how to reverse the compressed word.


#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main()
{
// Declarations: Declaring variables
string sentence, choice, reversed_word, lower_sentence;
int numletters, i;
char letter;

do
{
cout << "Enter a sentence to check: " << endl;
getline(cin, sentence);

numletters = sentence.length();

for (i=0; i<= numletters; i++)
{
letter = tolower(sentence[i]);
if (letter != ' ')
{
lower_sentence = lower_sentence + letter;
}
}

cout << "Compressed: " << lower_sentence << endl;

}
while (choice == "Y" || choice == "y");
system ("pause");
return 0;
}
Please do not post more than once:
http://www.cplusplus.com/forum/beginner/114217/
Topic archived. No new replies allowed.