Reading in Functions

Joseph N. Hall jnh at ecemwl.ncsu.edu
Thu Oct 19 07:26:12 AEST 1989


In article <1989Oct18.202238.22792 at ux1.cso.uiuc.edu> mcdonald at aries.scs.uiuc.edu (Doug McDonald) writes:
>In article <1197 at utkcs2.cs.utk.edu> wozniak at utkux1.utk.edu (Bryon Lape) writes:
>>
>>	How does one write a procedure in C so that the user can type in
>>a formula from the keyboard and the programme will graph it?  I can
>>handle the graphing part, but what I want to be able to do is is have a
>>programme that will read in a function and graph the result.

>Well, you read the formula into a char array and then either 
>interpret or compile it to get a y value at each x point....

When you say "compile," what exactly do you mean?  As a sort of quick-
and-dirty kludge (for UNIX users only) you could read the user's input,
wrap it in some braces and declarations, write it to a file, cc it,
link it into the user's program on-the-fly (with ld) and then ... voila
... plot it.  Like I said, quick and dirty ...


v   v sssss|| joseph hall                      || 4116 Brewster Drive
 v v s   s || jnh at ecemwl.ncsu.edu (Internet)   || Raleigh, NC  27606
  v   sss  || SP Software/CAD Tool Developer, Mac Hacker and Keyboardist
-----------|| Disclaimer: NCSU may not share my views, but is welcome to.



More information about the Comp.lang.c mailing list