Update a1/program.c
This commit is contained in:
parent
51325b71d5
commit
ee2339517a
22
a1/program.c
22
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;
|
||||
|
Loading…
Reference in New Issue
Block a user