Suppose I did not read the data directly into a stack, because I need to to through each character to decide if it's going to be print out or not.
My idea is to read the chars in the array to the stack, and then do the processing where I can use stack.pop and cout to print out the chars (some will be reversed, some won't)
My code looks something like this, but it would not do the stack.push from the very begining. Anyone knows why?
...
Stack stack1;
for (int i = 0; i <arraySize; i++)
{
//different states here
switch (state)
{
case 1:
if ( A[i] != '\"' )
stack1.push(A[i]) //assertation is done in the the stack.h located outside
...
}
Thank you.