a1
This commit is contained in:
parent
d723f30ad8
commit
8e17d44983
13
a1/program.c
13
a1/program.c
@ -27,18 +27,21 @@ int main() {
|
||||
else if (stack[x-1] == '<') expected = '>';
|
||||
|
||||
if (vstup[j] != expected) {
|
||||
if(expected != '\0'){
|
||||
printf("Crossed bracket %c in %d, expected %c\n", vstup[j], j, expected);
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
printf("Unexpected closing bracket %c in %d\n", vstup[j], position[x-1]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
x--;
|
||||
expected = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x > 0) {
|
||||
printf("Unexpected closing bracket %c in %d\n", stack[x-1], position[x-1]);
|
||||
} else {
|
||||
printf("All brackets OK\n");
|
||||
}
|
||||
printf("All brackets OK\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user