Question: c++ using stacks. Supposed to get a string and push it through a stack, and then compare, if symmetrical then return true. So for instance,

c++ using stacks. Supposed to get a string and push it through a stack, and then compare, if symmetrical then return true. So for instance, abccba would be true. pabccba would be false. Program mostly works but I am stuck on a bug. Help with a fix would be greatly appreciated. The problem I am having is that if I put any two letters, it will return true. Even if the string is not symmetrical. such as 'ab' will return true when it should be false. only 'aa' and strings that are symmetrical should return true. Not sure if it's the checking in the for loop is the problem, or if it needs an if statement somehwere.

source: https://pastebin.com/2T333VMZ

header: https://pastebin.com/sEiKG0mK

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!