-
Has anyone ever written a function parser to do simple arithmetic? (obviously + - * / ^, maybe Sqr, log, ln, sin, cos, tan etc.)
It would have to handle nested parentheses and recognise numbers as well as variables.
(e.g. have a list of assignable variables like a-z, and then be able to type and evaluate a string such as:
((a+b)^c)*2.6 + 1
)
I've tried it before (in FORTRAN of all things) and its pretty hard....
Just curious...
:cool:
Dan
-
I have done it in C
It was really nice to work out that program.
I wrote a program which will generate a Prefix an Postfix exression.
Even I worked with another program which will find the number of executable lines in a C program.
Here the input is a file with .c or .cpp extension and it will count the number of executable lines. here I have to find the '{' and also take into consideration the decalration statements.
Even more interesting to me was generating a flowchar ( using c graphics) from a c program. When a .C file is given as input this application will generate the flowchar for that program. It really interesting to work with for loops and while loops and IF else conditions.....
I am now working in VB but I still feel I love programming in C and C++ and as they are most creative
Ramdas
-
I've done one in vb, but it's slow