From 8fbc2f9afba8588634e8a1ff5cd02480bf67b888 Mon Sep 17 00:00:00 2001 From: Yurii Chechur Date: Thu, 24 Oct 2024 20:18:29 +0000 Subject: [PATCH] Update a1/program.c --- a1/program.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/a1/program.c b/a1/program.c index 9715222..cab789f 100644 --- a/a1/program.c +++ b/a1/program.c @@ -21,9 +21,11 @@ int main() { char stack[100]; int top = -1; - //printf("Введіть код: "); + // printf(""); fgets(input, 101, stdin); + printf("Read: %s", input); + for (int i = 0; i < strlen(input); i++) { char current = input[i]; @@ -40,11 +42,11 @@ int main() { return 1; } if (!isMatching(stack[top], current)) { - printf("Crossed bracket '%c' in %d , expected \n", + printf("Crossed bracket '%c' in %d , expected \n", current, i); (stack[top] == '{') ? '}' : (stack[top] == '[') ? ']' : (stack[top] == '(') ? ')' : '>', - current, i); + current, i; return 1; } top--;