home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / pascal / 6455 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  1.6 KB

  1. Path: sparky!uunet!utcsri!newsflash.concordia.ca!sifon!charnel!psmedsha
  2. From: psmedsha@ecst.csuchico.edu (Paul Smedshammer)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Help Converting :='x+y' to :=x+y
  5. Date: 10 Nov 1992 04:56:53 GMT
  6. Organization: California State University, Chico
  7. Lines: 35
  8. Message-ID: <1dnfelINNp09@charnel.ecst.csuchico.edu>
  9. NNTP-Posting-Host: cscihp.ecst.csuchico.edu
  10.  
  11. I don't know if this is a simple thing to do but I have not
  12. been able to figure it out.  I would like to take a string 
  13. of characters that represent an equation and implement that
  14. equation.  For example:
  15.  
  16.      Var  Equation : String[20];
  17.           x, y, Solution : Real;
  18.      Begin
  19.           Equation := 'x + y';
  20.           x := 1;
  21.           y := 2;
  22.              {'now right here I would like to be able
  23.              to use the equation in the string Equation
  24.              like this:
  25.           Solution := Somefunction(Equation);
  26.              Is this easily done?'}
  27.           Writeln('The solution is:',Equation,'=',Solution);
  28.      End.
  29.  
  30. I would like the user to be able to input an equation and
  31. then the program will perform different mathematics on that
  32. equation.  But to be able to do the mathematics I need to 
  33. get the input equation into the form " Solution := x + y".
  34. I would appreciate any help I can get on this.  I'm stuck now
  35. to changing the code for each different equation I use.  Thanks
  36. for your time.
  37.  
  38. Paul
  39.  
  40. ------------------------------------------------------------------------------
  41. psmedsha@ecst.csuchico.edu (Paul Smedshammer)
  42.  
  43. Graduate Student in Mechanical Engineering
  44. California State University at Chico
  45. ------------------------------------------------------------------------------
  46.