From ee2339517ac571afadcbe39358925e2678272308 Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Fri, 25 Oct 2024 20:03:19 +0000 Subject: [PATCH] Update a1/program.c --- a1/program.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/a1/program.c b/a1/program.c index 27d925d..2222586 100644 --- a/a1/program.c +++ b/a1/program.c @@ -69,7 +69,7 @@ int main() if(c=='<'||c=='('||c=='{'||c=='[') { push_stack(&mystack, c); - print_stack(&mystack); + } if(c=='>'||c==']'||c=='}'||c==')') { @@ -80,24 +80,24 @@ int main() printf("fghfghfgghfghfggh"); is_ok=false; } - if(cs!='<') + if(c=='>' && cs!='<') { - printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); + printf("\nCrossed bracket %c in %d, expected %c", c, i, para(c)); is_ok=false; } - if(cs!='(') + if(c==')' && cs!='(') { - printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); + printf("\nCrossed bracket %c in %d, expected %c", c, i, para(c)); is_ok=false; } - if(cs!='(') + if(c==')' && cs!='(') { - printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); + printf("\nCrossed bracket %c in %d, expected %c", c, i, para(c)); is_ok=false; } - if(cs!='{') + if(c=='}' && cs!='{') { - printf("Crossed bracket %c in %d, expected %c", c, i, para(c)); + printf("\nCrossed bracket %c in %d, expected %c", c, i, para(c)); is_ok=false; } } @@ -105,9 +105,9 @@ int main() } if(is_ok) - printf("All bracket OK"); + printf("\nAll bracket OK"); + -//Crossed bracket > in 12, expected ) return 0;