|
-
May 18th, 2000, 09:13 PM
#1
Thread Starter
Hyperactive Member
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...

Dan
-
May 18th, 2000, 09:24 PM
#2
Lively Member
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
-
May 18th, 2000, 10:09 PM
#3
transcendental analytic
I've done one in vb, but it's slow
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|