Practical No.9
Practical No.9
Name:
Name:Swapnil ManishKamble
Paras Chandan Suryawanshi
Class: SE
Div: C
Batch: C3
Roll
RollNo:S213074
No:S213085
Problem Statement: In any language program mostly syntax error occurs due to
unbalancing delimiter such as (),{},[]. Write C++ program using stack to check
whether given expression is well parenthesized or not.
CODE:-
Code:
#include<iostream>
#include<string.h>
using namespace std;
class Braces{ char
stack[20]; int top;
public: Braces(){ top
= -1;
stack[top]=a;
void pop(){
if(top==-l){ cout<<"stack is
empty"<<endl;
}top--;
bool isempty(){
if(top==-l)
return true;
else return
false;
found"<<endl;
if(ch[i]=='}'){ if (top!=-l &&
pop();} else cout<<"Opening Matching
bracket not
found"<<endl;
if (top!=-l && pop();} else
cout<<"Opening Matching bracket
not
found"<<endl;
int main(){
Braces bl;
bl.input();
return O;
Output: