Hello,

I'm trying to do this stack container that reads a string and is supposed to find if the string has a balanced parentheses (opening and closing parentheses). for example

Z+ X- Y //no parentheses

Z * X / (Y+10) //Matching parenthesis

Z * ((X / Y) + D + (F-10) //Parenthesis don’t match. Missing right parenthesis

Z * (X / Y) + W + (F-10)) //Parenthesis don’t match. Missing left parenthesis

so far this is what I got

Code:#define STACK_MAX 100 class Stack { private: int data[STACK_MAX]; int size; public: Stack() { // Constructor size = 0; } ~Stack() { } // Destructor int top() { if (size == 0) { printf("Error: stack empty\n"); return -1; } return data[size-1]; } void push(int d) { if (size < STACK_MAX) data[size++] = d; else printf("Error: stack full\n"); } void pop() { if (size == 0) printf("Error: stack empty\n"); else size--; } }; int main() { return 0; }