Program 5 Stack Write a program that uses a stack to determine if grouping symbols, such as parentheses and braces, if an arithamtaic expression matches. For example, the expression (25 + ( 3 - 6 ) * 8) contains matching grouping symbols. If the expressiom conatains error, output an appropriate error message. I am posting the main and header code for a program that needs to be modified to achieve the above requirment The main program // Postfix Calculator #include #include #include #include "my stack.h" using namespace std; void evaluate(ifstream& in,ofstream& out,stackType& stack, char& ch,int& flag); void discard(ifstream& in, ofstream& out, char& ch); int main() { double num, result; int flag; char ch; stackType stack(100); ifstream infile; ofstream outfile; [login to view URL]("a:[login to view URL]"); [login to view URL]("a:[login to view URL]"); [login to view URL](ios::fixed, ios::floatfield); [login to view URL](ios::showpoint); outfile<<setprecision(2); // print num to two decimal places infile>>ch; while(infile) { [login to view URL](); flag = 0; outfile<<ch; while(ch != '=') { switch(ch) { case '#' : infile>>num; outfile<<num<<" "; if(![login to view URL]()) [login to view URL](num); infile>>ch; outfile<<ch; if(ch != '#') outfile<<" "; break; default: evaluate(infile, outfile, stack, ch, flag); if(!flag) //if no error { infile>>ch; outfile<<ch; if(ch != '#') outfile<<" "; } }//end switch }// end while (!= '=') if(!flag) //if no error print result { if(![login to view URL]()) { [login to view URL](result); if([login to view URL]()) outfile<<result<<endl; else outfile<<" (Error: Too many operands)"<<endl; }//end if else outfile<<" (Error in the expression)"<<endl; } else outfile<<" (Error in the expression)"<<endl; outfile<<"_________________________________"<<endl<<endl; infile>>ch; //Begin processing the next expression }//end while return 0; }//end main void evaluate(ifstream& in, ofstream& out, stackType& stack, char& ch,int& flag) { double op1, op2; if([login to view URL]()) { out<<" (Not enough operands)"; discard(in,out,ch); flag = 1; }
## Deliverables
Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased.
## Platform
Win Me Visual C++ 6.0