I am writing a program that implements an rpn type calculator while getting the values for it from a file. I am trying to figure out how I can Evaluate an expression when the operator is retrieved from the file. Right now I have this..
Code:
double rpn_eval(char * fileName, double x){
double a,b,c;
File *fd;
fd = fopen(fileName);
char * word;
while (word = nextword(fd)){
if (word >= '0' && word <= '9'){
stack_push(word);
}else{
a = stack_pop();
b = stack_pop();
//I want to evalute b (word) a
}
}
If you could also redirect me to some source material so I could read about it that would be greatly appreciated, Thanks!