C++ - Using a stack to determine if a C style string is a palindrome -


I am working on assignment for class. We were provided with it (Linked here, editors were different when they tried to do it on separate lines).

We should take it in a string and then test it to test these sections, if it is a palladium, we have not modified the sections said.

And here is my int main :

  #include & lt; Iostream & gt; # Include & lt; Cstring & gt; # Include & lt; cctype & gt; #include "stack.h" using namespace std; Int main () {four test string [100]; Pile & lt; Four & gt; CharStack; Cout & lt; & Lt; "Please enter a string: \ n & gt;"; Cin.getline (teststring, 100); Four cap; (Int i = 0; i & lt; strlen (teststring); i ++) {if (islfa (teststring [i])) {caps = toper (teststring [i]); charStack.push (caps); }} For (int j = 0; j & lt; strlen (teststring); j ++) {if (islpha (teststring [j]) {caps = toufper (teststring [j]); If (charStack.firstPtr-> getData () == Caps) {// This part issue is private in FirstPtr list.h, and I want to compare char array to data in stack charStack.pop (caps) Can not understand another method for; }}} If (charStack.isStackEmpty ()) {cout & lt; & Lt; Andal & lt; & Lt; Andal & lt; & Lt; "\" "<  

As you can see, I can not quite understand how to compare data popped up in the array around the data in the array. Stack class only gives the boolean, and the pointer in the ListNode object in the class list is private, so I can not use that class's "getData" function! Is there any suggestion that can help me?

Thank you!

view function Stack :: pop (STACKTYPE & amp; data)

This takes a non-reference reference argument in which the element is being removed (this is actually list :: removalFramefrint (NODETYPE and value) ).

This means that you can pass char to the pop () function, and after that the data will be included that you are looking for.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -