Update a1/program.c

This commit is contained in:
Yurii Yakovenko 2024-10-25 20:03:19 +00:00
parent 51325b71d5
commit ee2339517a

View File

@ -69,7 +69,7 @@ int main()
if(c=='<'||c=='('||c=='{'||c=='[') if(c=='<'||c=='('||c=='{'||c=='[')
{ {
push_stack(&mystack, c); push_stack(&mystack, c);
print_stack(&mystack);
} }
if(c=='>'||c==']'||c=='}'||c==')') if(c=='>'||c==']'||c=='}'||c==')')
{ {
@ -80,24 +80,24 @@ int main()
printf("fghfghfgghfghfggh"); printf("fghfghfgghfghfggh");
is_ok=false; 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; 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; 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; 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; is_ok=false;
} }
} }
@ -105,9 +105,9 @@ int main()
} }
if(is_ok) if(is_ok)
printf("All bracket OK"); printf("\nAll bracket OK");
//Crossed bracket > in 12, expected )
return 0; return 0;