I need help with this question please if someone is willing to help

Using class template to solve following so called “In Language” Problem:

A string is considered to be “In Language” if it is “symmetric to a $ sign. That means the letter or digits on the left side of the $ in the string have to be the same as the letter or digits on the right side of the $ sign except they are in the reversed order.
Followings are examples of in language strings:
“\0” (empty string), “$”, “abc$cba”, “123amxc&cxma321”
Followings are examples of the strings that are not in language:
“abccba”, “abcd123”, “abc$abc”, “$abc123”, “xyz456$”, “ab$bac”.

Write a function that receives a string of characters and returns true if the string is in language, otherwise return false. Please use following header for the function:

bool inLanguage(char []);

Following algorithm shows how to write such function:

Algorithm:
• Push all the characters to a stack until we meet a ‘$’
• Skip ‘$’, then retrieves the last added character from the stack and compare it with the next character in the string, it they don’t match, then the string is not in the language. It they do, pop the character from the stack, then retrieve the next character from the stack and compare it with the next character in the string.

• We repeat this process as long as the stack is not empty or we are not reach the end of the string.
• We will break above loop and return false value when we meet one of the following cases:
• 1. The stack is empty but we have not reach the end of the string
• 2. The stack is not empty but we have reach the end of the string
• 3. The stack is not empty and we have not reach the end of the string, but the character that is no the top of the stack is not matching the next character in the string
• This is because if one of above three cases occurs the string is not going to be symmetric to the $ and thus it is not in the language.
• If we have not met any of those three cases, we will pop and move along the string until the stack is empty AND we reach the end of the string, in such case, the string is in the language, the function returns a True value.
What don't you understand? What do you have so far?

We are going to need more specific information as to where you are at and what you are having trouble with to be able to help you.
I just don't understand it all
Topic archived. No new replies allowed.