Write a C++ program to check if the user\'s input is palindrome or not. You shou
ID: 3631156 • Letter: W
Question
Write a C++ program to check if the user's input is palindrome or not. You should use both stack and queue. Has to compare string in queue and stack to see if they are the same, if so then it will pop. Modify program in visual studio c++.
ex)what I need to do: stack(column) a b c a queue(row) a b b a if it doesnt match use break.
if it does pop until empty. Allow user to input string.
#include <iostream>
#include <queue>
#include <stack>
#include <string>
using namespace std;
int main (){
queue<int> MyQueue;
stack<int> MyStack;
string input="my name";
int Queue;
int Stack;
//declare a char Queue and a char stack
//string.at[i]
for (int i=0;i<input.length();i++)
{
cout<<input.at(i)<<" ";
}
cout<<endl;
for (i=0; i<10; i++)
{
MyQueue.push(input.at(i));
MyStack.push(input.at(i));
}
//push characters into stack and queue
cout<< "MyQueue:"<<endl;
for (i=0; i<10;i++)
{
cout<<MyQueue.front()<<" ";
MyQueue.pop();
}
cout<<endl;
cout<< "MyStack:"<<endl;
for (i=0; i<10; i++)
{
cout<<MyStack.top()<<" ";
MyStack.pop();
}//end while
cout<<endl;
if (MyStack.top==MyQueue.front)
{
MyStack.pop();
MyQueue.pop();
}
else
break;
if (!MyStack.top==MyQueue.front)
return 0;
}