diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f3f956c --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +#how to run it +#http + +CC=gcc +CFLAGS= -c -Wall +LFLAGS1= -lm +CFLAGS2= -std=c99 +all: prog +prog: calc.o helpers.o + $(CC) calc.o helpers.o -o prog $(LFLAGS1) +calc.o: calc.c + $(CC) $(CFLAGS) calc.c +helpers.o: helpers.c + $(CC) $(CFLAGS) helpers.c +clean: + rm -rf *.o diff --git a/calc b/calc new file mode 100755 index 0000000..51f025d Binary files /dev/null and b/calc differ 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; } diff --git a/prog b/prog new file mode 100755 index 0000000..51f025d Binary files /dev/null and b/prog differ