Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Prompt: You are going to write a program that lets the user know if aword is spe

ID: 3611097 • Letter: P

Question

Prompt:
You are going to write a program that lets the user know if aword is spelled the same in reverse. First
ask the user to type a word and read it into a char array. Startingwith the first letter, push all the
letters into a STL stack container implemented as a vector. Thenpop the letters from the stack.
As you remove the letters from the stack, you need to display themon the screen and also determine if
the word is the same in both directions. Let the user know if theword is spelled the same in both
directions.

Sample Output 1:

Type in a word: noon
Pushing n into the stack...
Pushing o into the stack...
Pushing o into the stack...
Pushing n into the stack...
Here is your word in the other direction: noon
The word is same in both directions
Press any key to continue...

Sample Output 2:
Type in a word: desk
Pushing d into the stack...
Pushing e into the stack...
Pushing s into the stack...
Pushing k into the stack...
Here is your word in the other direction: ksed
The word is not the same in both directions
Press any key to continue...

Explanation / Answer

Hi, this code does the job. I wrote it fairlyquick. Should be good. // note on the line where you have "press any key tocontinue..." I gave the option of quiting by entering thechar q so that the user can terminate the program if wanted. Hope this helps: #include #include #include using namespace std; int main() { stack s; vectorinput;               // I used a vector for the input, if this is not alright, Ican rewrite. char ch; bool cont = true; while( cont )     {       cout