Write a program that reads a line of text, changes each uppercase letter to the lowercase, and
places in a queue and onto a stack. The program should then verify whether the line of text is
a palindrome.

No. You write a program that reads a line of text, changes each uppercase letter to the lowercase, and places in a queue and onto a stack. When you've done that, show us what you have got and what help you need.

Nobody is here to do your homework for you, sorry to disappoint...

You take some amount of time to work on this program. And then come up with the result of the program you have worked. Specify any errors or modification you need to correct. We'll try to work on that.

Please check out the code below. If there any mistake, please point out.

#include <iostream> 
#include <stack> 
#include <queue> 
#include <string> 

using namespace std; 

bool operator==(const stack<char>&, const queue<char>&); 
bool operator!=(const stack<char>&, const queue<char>&); 

int main(int argc, char *argv[]) { 
    stack<char> *s; 
    queue<char> *q; 
    string input; 
    string::iterator i; 

    while (true) { 
        s = new stack<char>; 
        q = new queue<char>; 

        cout << "> "; 
        getline(cin,input); 
        for (i = input.begin(); i != input.end(); i++) { 
            s->push(*i); 
            q->push(*i); 
        } 
        cout << input << " is "; 
        if (*s != *q) { 
            cout << "not "; 
        } 
        cout << "a palindrome." << endl; 

        delete s; 
        delete q; 
    } 

    return 0; 
} 

bool operator==(const stack<char> &s1, const queue<char> &q1) { 
    bool eq = true; 
    stack<char> s = s1; 
    queue<char> q = q1; 

    if (s.size() == q.size()) { 
        while ((s.empty() == false) && (eq == true)) { 
            eq = (s.top() == q.front()); 
            s.pop(); 
            q.pop(); 
        } 
    } else { 
        eq = false; 
    } 
    return eq; 
} 

bool operator!=(const stack<char> &s, const queue<char> &q) { 
    return !(s == q); 
} 

:-) We have all done that. Just remember, we are trying to help students to learn how to fish. Not just feed them a fish! Anyway, as per my comment, your intention was good, but the results may not help the student in the long term. I know I have had, in my career as a principal software engineer, to terminate "engineers" who had not learned this lesson. They did not help the organization, and in some cases absolutely caused serious problems with our customers. FWIW, a couple of these people had "earned" PhD's. I suspect that they did not do their own research and analysis to earn their degrees!

i know that this is your homework. Don't you think that at least once you should try it out yourself. Just write your code and if it not working post that code here, you will get solution. Don't merly depend other in doing your homework dear

This article has been dead for over six months. Start a new discussion instead.