From b1cc3ef186db11ef077caab4667df28356fe97e1 Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Fri, 25 Oct 2024 20:48:21 +0000 Subject: [PATCH] Update a1/program.c --- a1/program.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/a1/program.c b/a1/program.c index a1a724e..b9dc81c 100644 --- a/a1/program.c +++ b/a1/program.c @@ -57,7 +57,7 @@ int main() mystack.size=0; char str[128]; - + //scanf("%s", str); fgets(str,100,stdin); if(str[strlen(str)-1]=='\n') { str[strlen(str)-1]='\0';} printf("Read: %s", str); @@ -71,7 +71,7 @@ int main() if(c=='<'||c=='('||c=='{'||c=='[') { push_stack(&mystack, c); - + } if(c=='>'||c==']'||c=='}'||c==')') { @@ -85,25 +85,25 @@ int main() } if(c=='>' && cs!='<') { - printf("\nCrossed bracket %c in %d, expected %c", c, i, para(cs)); + printf("\nCrossed bracket %c in %d, expected %c \n", c, i, para(cs)); is_ok=false; break; } if(c==']' && cs!='[') { - printf("\nCrossed bracket %c in %d, expected %c", c, i, para(cs)); + printf("\nCrossed bracket %c in %d, expected %c \n", c, i, para(cs)); is_ok=false; break; } if(c==')' && cs!='(') { - printf("\nCrossed bracket %c in %d, expected %c", c, i, para(cs)); + printf("\nCrossed bracket %c in %d, expected %c \n", c, i, para(cs)); is_ok=false; break; } if(c=='}' && cs!='{') { - printf("\nCrossed bracket %c in %d, expected %c", c, i, para(cs)); + printf("\nCrossed bracket %c in %d, expected %c \n", c, i, para(cs)); is_ok=false; break; } @@ -111,7 +111,7 @@ int main() i++; } - if(is_ok) + if(is_ok) { if(count_stack(&mystack)>0) { @@ -128,7 +128,6 @@ int main() } - return 0; } \ No newline at end of file