a1
This commit is contained in:
parent
f44455c266
commit
db6299520f
13
a1/program.c
13
a1/program.c
@ -43,11 +43,14 @@ int main() {
|
||||
}
|
||||
}
|
||||
if (x > 0) {
|
||||
if (stack[x-1] == '{') expected = '}';
|
||||
else if (stack[x-1] == '[') expected = ']';
|
||||
else if (stack[x-1] == '(') expected = ')';
|
||||
else if (stack[x-1] == '<') expected = '>';
|
||||
printf("Missing closing brackets: %c\n", expected);
|
||||
printf("Missing closing brackets: ");
|
||||
for (int i = 0; i < x; i++) {
|
||||
if (stack[i] == '{') printf("}");
|
||||
else if (stack[i] == '[') printf("]");
|
||||
else if (stack[i] == '(') printf(")");
|
||||
else if (stack[i] == '<') printf(">");
|
||||
}
|
||||
printf("\n");
|
||||
} else {
|
||||
printf("All brackets OK\n");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user