So found this C code online and need to compile it in Terminal on Mac.
Here is the code:
#include <stdio.h>
#include <math.h>
int option;
char q;
int number;
int currentsum;
int value;
void calc()
{
printf("\t\t\t\t\tBegin\n"); // says begin in top middle of screen
option = 0; number = 0; currentsum = 0; value = 0;
while(1){
value = getchar(); // gets user input and sets equal to value
if (value >= '0' && value <= '9')
{
number = number*10 + (value - '0'); /* a way of reading the "values" left to right. If someone puts in 729 as their first number then it will go across
and do number = 0*10 (because number was set equal to 0) + 7. then it goes through again. number is now 7 so it goes through and does 7*10 + 2 thus making
72. Number is now 72 which means it goes 72*10 + 9 making number 729. It will follow this process if the input is a number 1-9*/
}
if (value == '+' || value == '-' || value == '*' || value == '/' || value == '^' || value == '=' || value == '\n')
{
if(value == '+') currentsum = currentsum + number; // if I come across one of these symbols then it performs the operation described
if(value == '-') currentsum = currentsum - number;
if(value == '*') currentsum = currentsum * number;
if(value == '/') currentsum = currentsum / number;
if(value == '^') currentsum = pow(currentsum, number);
if(value == '=') printf(currentsum); // when it reads an equal sign or a new line it displays the result of the equation.
if(value == '\n') printf(currentsum);
}
else break; // come across any other symbols or characters break the loop
}
}
int main()
{
system("title Calculator"); // titles windo "Calculator
system("color 1A"); // makes background blue
calc(); // goes to void calc
system("pause");
scanf("%c",&q);
if( q == 'q')exit(0);
}
Now just to let you know i do not want to use anything else to compile it except for the Terminal.