Question: I need help adding to my code below, which is in C++ and it needs to read the string of symbols from a HTML source
I need help adding to my code below, which is in C++ and it needs to read the string of symbols from a HTML source file (et.html) and have it print "legal" or "illegal" as the result.

#include
#define MAX 1000
using namespace std;
class Stack{
int top;
public:
int a[MAX]; // Max size of Stack
Stack(){
top = -1;
}
//top is initialized to -1 to check the emptiness of the stack
bool push(int x);
int pop();
bool isEmpty();
int peek();
};
int Stack::peek(){
return a[top];
}
bool Stack::push(int x){
if (top >= MAX){
cout
return false;
}
else{
a[++top] = x;
return true;
}
}
int Stack::pop(){
if (top
return 0;
else{
int x = a[top--];
return x;
}
}
//Checks the stack if its empty or not
bool Stack::isEmpty(){
return (top
}
// checks for pairs
bool Pair(char opening,char closing){
if(opening == '(' && closing == ')') return true;
else if(opening == '{' && closing == '}') return true;
else if(opening == '[' && closing == ']') return true;
return false;
}
bool Balanced(string exp){
Stack S;
for(int i =0;i if(exp[i] == '(' || exp[i] == '{' || exp[i] == '[') S.push(exp[i]); else if(exp[i] == ')' || exp[i] == '}' || exp[i] == ']'){ if(S.isEmpty() || !Pair(S.peek(),exp[i])) return false; else S.pop(); } } return S.isEmpty() ? true:false; } int main(){ string expression; // input expression ifstream in("program.c"); if(in.is_open()) { expression = ""; string line; while(getline(in, line)) { expression += line+" "; } } else { cout return 0; } // check expression if (Balanced(expression)) cout else cout return 0; } The Engineering Technology Department is one of six academic departments in the College of Engineering at The University of Toledo. The Department offers ABET-accredited professional technical programs leading to the Bachelor of Science degree in four areas of study. The Engineering Technology Department is one of six academic departments in the College of Engineering at The University of Toledo. The Department offers ABET-accredited professional technical programs leading to the Bachelor of Science degree in four areas of study. ET Department
ET Department
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
