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; }
Comments
Leave a comment