Update a1/program.c
This commit is contained in:
parent
19067c47b9
commit
6d31ca1356
34
a1/program.c
34
a1/program.c
@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@ -85,5 +108,4 @@ int main()
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user