Stack HELP Please

Given a text file, your program will determine if all the parentheses, curly braces, and square brackets match, and are nested appropriately. Your program should work for mathematical formulas and computer programs. ! Your program should read in the characters from the file, but ignore all characters except for the following: { } ( ) [ ]

so far what i got
cpp intstack file

IntStack::IntStack(int size)
stackArray = new int[size];
stackSize = size;
top = -1;

delete [] stackArray;

void IntStack::push(int num)
assert (!isFull()); // will exit program if this happens
stackArray[top] = num;

int IntStack::pop()
assert(!isEmpty()); // will exit program if this happens
int num = stackArray[top];
return num;

bool IntStack::isFull() const
return (top == stackSize - 1);

bool IntStack::isEmpty() const
return (top == -1);

cpp main
int main()
char c;
ifstream inFile;
//cout << "Enter the filename.";
//cin, filename;"testing.txt");

if (!inFile)
cout << "File could now be opened. Program terminated."<< endl;
return 1;

return 0;

program should prompt the user to enter a filename. should then try to open the file and then check it make sure the brackets all match appropriately. If they all match, the program should output a message saying so.
If not, the program should output an appropriate error message.

There are three types of errors that can happen (and they can happen with any kind of bracket): ! missing } : if you reach the end of the file, and there is an opening { that was never matched, like: int main () { x[size]=10; expected } but found ) : this is a wrong closing bracket, like: {x[i]=10;)... unmatched } : this occurs if there is a closing bracket but not an opening bracket (not even one of the wrong kind), like: int main () { x[i]=10; } }...
Topic archived. No new replies allowed.