I am trying to get a small piece of a program i am writing to receive a simple math expression, with two int variables and 1 char for the operator, and then i will work it with an if(){}if else statement. I just don't know how to separate the string into variables. Can anyone help? I have read a lot of stuff on the web and it is more confusing than my c programming class.
include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define bufSize 8160
int main(){
char evalString [bufSize];
char evalOp;
int evalInt1, evalInt2, evalAns;
printf("Enter valid Simple Equation:\n ");
fgets(evalString,bufSize,stdin);
//this is where i am stuck, what will read the char and both int's and store them in memory
evalAns = (evalInt1 evalOp evalInt2) //not sure that will work either
printf("%d %c %d = %d", evalInt1, evalOp, evalInt2, evalAns)
scanf("%*c");
return 0;
}
Thanks!