Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!gatech!ncsuvx!ecemwl!jnh From: jnh@ecemwl.ncsu.edu (Joseph N. Hall) Newsgroups: comp.lang.c Subject: Re: Reading in Functions Message-ID: <4231@ncsuvx.ncsu.edu> Date: 18 Oct 89 21:26:12 GMT References: <1197@utkcs2.cs.utk.edu> <1989Oct18.202238.22792@ux1.cso.uiuc.edu> Sender: news@ncsuvx.ncsu.edu Reply-To: jnh@ecemwl.UUCP (Joseph N. Hall) Organization: North Carolina State University Lines: 22 In article <1989Oct18.202238.22792@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: >In article <1197@utkcs2.cs.utk.edu> wozniak@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@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.