home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!newsflash.concordia.ca!sifon!charnel!psmedsha
- From: psmedsha@ecst.csuchico.edu (Paul Smedshammer)
- Newsgroups: comp.lang.pascal
- Subject: Help Converting :='x+y' to :=x+y
- Date: 10 Nov 1992 04:56:53 GMT
- Organization: California State University, Chico
- Lines: 35
- Message-ID: <1dnfelINNp09@charnel.ecst.csuchico.edu>
- NNTP-Posting-Host: cscihp.ecst.csuchico.edu
-
- I don't know if this is a simple thing to do but I have not
- been able to figure it out. I would like to take a string
- of characters that represent an equation and implement that
- equation. For example:
-
- Var Equation : String[20];
- x, y, Solution : Real;
- Begin
- Equation := 'x + y';
- x := 1;
- y := 2;
- {'now right here I would like to be able
- to use the equation in the string Equation
- like this:
- Solution := Somefunction(Equation);
- Is this easily done?'}
- Writeln('The solution is:',Equation,'=',Solution);
- End.
-
- I would like the user to be able to input an equation and
- then the program will perform different mathematics on that
- equation. But to be able to do the mathematics I need to
- get the input equation into the form " Solution := x + y".
- I would appreciate any help I can get on this. I'm stuck now
- to changing the code for each different equation I use. Thanks
- for your time.
-
- Paul
-
- ------------------------------------------------------------------------------
- psmedsha@ecst.csuchico.edu (Paul Smedshammer)
-
- Graduate Student in Mechanical Engineering
- California State University at Chico
- ------------------------------------------------------------------------------
-