From d1f6f7e1ed5aacafec797eb3ebf614b7e4ae1d68 Mon Sep 17 00:00:00 2001 From: Shlomi Date: Mon, 31 Dec 2018 12:56:20 +0000 Subject: [PATCH 1/2] Pow bug fixed --- calc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calc.c b/calc.c index dca5452..7ac2177 100644 --- a/calc.c +++ b/calc.c @@ -33,7 +33,7 @@ static struct token* opStack; static int outCount; static double* outStack; -static const int binary[] = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; +static const int binary[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }; static const int precedence[] = { 0, 0, 1, 1, 1, 2, 3, 4, 4, 5 }; static const int association[] = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; @@ -91,7 +91,7 @@ int execute(struct token temp) { case '%': result = fmod(d1, d2); break; - case '#': + case '^': result = pow(d1, d2); break; } From 3f3ec5190b8ec20b428a2eb0b1815ca991fb6dc8 Mon Sep 17 00:00:00 2001 From: Shlomi Date: Mon, 7 Jan 2019 10:24:10 +0000 Subject: [PATCH 2/2] Added new makefile --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..52a4698 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +CC=gcc +CFLAGES= -c -Wall +all:prog +prog: calc.o helpers.o + $(CC) -o mycalc calc.o helpers.o -lm +calc.o: calc.c + $(CC) $(CFLAGES) calc.c +helper.o: helper.c + $(CC) $(CFLAGES) helpers.c +clean: + rm -rf *.o +