diff --git a/a1/program.c b/a1/program.c index b2980fe..27d925d 100644 --- a/a1/program.c +++ b/a1/program.c @@ -1,8 +1,8 @@ #include #include #include -#include -//// @ +#include + #define STACK_SIZE 200 struct Stack @@ -62,7 +62,8 @@ int main() int i=0; char c, cs; - while(str[i]!='\0') + bool is_ok=true; + while(str[i]!='\0' && is_ok) { c=str[i]; if(c=='<'||c=='('||c=='{'||c=='[') @@ -77,32 +78,34 @@ int main() else { printf("fghfghfgghfghfggh"); - break; + is_ok=false; } if(cs!='<') { printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); - break; + is_ok=false; } if(cs!='(') { printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); - break; + is_ok=false; } if(cs!='(') { printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); - break; + is_ok=false; } if(cs!='{') { printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); - break; + is_ok=false; } } i++; } + if(is_ok) + printf("All bracket OK"); //Crossed bracket > in 12, expected )