Update a1/program.c

This commit is contained in:
Yurii Yakovenko 2024-10-25 19:51:03 +00:00
parent 19067c47b9
commit 6d31ca1356

View File

@ -68,16 +68,39 @@ int main()
if(c=='<'||c=='('||c=='{'||c=='[')
{
push_stack(&mystack, c);
print_stack(&mystack);
}
if(c=='>')
if(c=='>'||c==']'||c=='}'||c==')')
{
cs=pop_stack(&mystack);
if(count_stack(&mystack)>0)
cs=pop_stack(&mystack);
else
{
printf("fghfghfgghfghfggh");
break;
}
if(cs!='<')
{
printf("Crossed bracket %c in %d, expected %c", c, i);
printf("Crossed bracket %c in %d, expected %c", c, i, para(c));
break;
}
if(cs!='(')
{
printf("Crossed bracket %c in %d, expected %c", c, i, para(c));
break;
}
if(cs!='(')
{
printf("Crossed bracket %c in %d, expected %c", c, i, para(c));
break;
}
if(cs!='{')
{
printf("Crossed bracket %c in %d, expected %c", c, i, para(c));
break;
}
}
i++;
}
@ -86,4 +109,3 @@ int main()
return 0;
}