Update a1/program.c
This commit is contained in:
parent
5272565d7c
commit
b1cc3ef186
13
a1/program.c
13
a1/program.c
@ -57,7 +57,7 @@ int main()
|
|||||||
mystack.size=0;
|
mystack.size=0;
|
||||||
|
|
||||||
char str[128];
|
char str[128];
|
||||||
|
//scanf("%s", str);
|
||||||
fgets(str,100,stdin);
|
fgets(str,100,stdin);
|
||||||
if(str[strlen(str)-1]=='\n') { str[strlen(str)-1]='\0';}
|
if(str[strlen(str)-1]=='\n') { str[strlen(str)-1]='\0';}
|
||||||
printf("Read: %s", str);
|
printf("Read: %s", str);
|
||||||
@ -85,25 +85,25 @@ int main()
|
|||||||
}
|
}
|
||||||
if(c=='>' && cs!='<')
|
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;
|
is_ok=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c==']' && cs!='[')
|
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;
|
is_ok=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c==')' && cs!='(')
|
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;
|
is_ok=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c=='}' && cs!='{')
|
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;
|
is_ok=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ int main()
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_ok)
|
if(is_ok)
|
||||||
{
|
{
|
||||||
if(count_stack(&mystack)>0)
|
if(count_stack(&mystack)>0)
|
||||||
{
|
{
|
||||||
@ -129,6 +129,5 @@ int main()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user