From 712451ad8403d8bf47089744546e248daf5a27c9 Mon Sep 17 00:00:00 2001 From: barak Date: Mon, 31 Dec 2018 14:57:01 +0200 Subject: [PATCH 1/2] fix ^ --- calc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/calc.c b/calc.c index dca5452..4c742f4 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 }; @@ -94,6 +94,10 @@ int execute(struct token temp) { case '#': result = pow(d1, d2); break; + case '^': + result = pow(d1, d2); + break; + } } From 5ec2f719a7adff326e4d391dadbb8004449956dc Mon Sep 17 00:00:00 2001 From: barak Date: Mon, 7 Jan 2019 12:25:01 +0200 Subject: [PATCH 2/2] add Makefile --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6abfca8 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +# https://github.com/BankHapoalim/calc.git +# to run this code type make in command line and see prog file create +CC=gcc +CFLAGES= -c -Wall +all: prog +prog: calc.o helpers.o + $(CC) calc.o helpers.o -lm -o prog +calc.o: calc.c + $(CC) $(CFLAGES) calc.c +helpers.o: helpers.c + $(CC) $(CFLAGES) helpers.c +clean: + rm -rf *.o +