I made some simple basix calculator in dev c++ like c program and I would like to change it a bit. Does anyone can help me make that this program will calculate like this:
you write 5*5 and it will write 25 and it will set in you new line and you will be able to write numbers again and it will calculate it again.
Now program calculate it and it just close after that.
It look like this:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{float a,b,r;
char op;
scanf("%f%c%f", &a, &op, &b);
switch(op)
{case '+':r=a+b;
printf("%f", r);
break;
case '-':r=a-b;
printf("%f", r);
break;
case '*':r=a*b;
printf("%f", r);
break;
case '/':r=a/b;
printf("%f", r);
break;
default: printf ("Nekaj ne delas prav"); }
system("PAUSE");
return 0;
}
Any idea what do I have to change to don't stop after 1st calculation ?
and I just figured out that it calculate only 5 numbers max so if I write 5*5*5 it will write me resault: 25 ... any idea on that too?
I'm new in programming so please don't flame me.
Symcy