Answer to Question #55035 in C++ for paul

Question #55035
write a program that reads a line of text ,changes each uppercase letter to lowercase ,and places each letter both in a queue and onto a stack .The program should then verify whether the line of text is apalindrome (a set of letter or numbers that is the same whether read forward or backward)
1
Expert's answer
2015-09-29T05:21:01-0400
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
std::string text;
cout << "Please, enter string:\n";
getline(std::cin, text);
std::transform(text.begin(), text.end(), text.begin(), ::tolower);
cout << text << endl;
if (text == string(text.rbegin(), text.rend()))
cout << text << " is a palindrome\n";
else
cout << text << " is not a palindrome\n";
system("pause");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS