Question: in c programming, appreciate C. Exercise: File IO and Function Plotting (10 marks) Part I. In this exercise, you will write a program which allows

in c programming, appreciatein c programming, appreciate C. Exercise: File IO and Function Plotting (10

C. Exercise: File IO and Function Plotting (10 marks) Part I. In this exercise, you will write a program which allows the user to select any one of the following five functions and write to a file the values of the function over a range that the user specifies f(x)-Vx-1+1 f(x)-x +1-x f (x) f(x)-sin(x)+ 0.1cos(10x) More specifically, the program executes according to the following steps 1. 2. 3. It prompts the user to select from the list of five functions It prompts the user to specify three values a, b, and N It prints to a file the values of the user-selected function over N uniformed spaced values of x in the interval [a, b]. The file should be an ASCII file named "myFunctionTable.dat". The content of the file should be formatted in two columns, where the first column contains the values of x, and the second column contains the corresponding value of ffx) In your implementation of the program, the program can interact with the user in any way you wish as long as it achieves its intended purpose. But your code must satisfy the following requirements 1. It uses a structure called USER INPUT to store all relevant information that the user enters 2. Getting input from the user must be implemented by a function called getUserInput. Computing the function values and writing to the file must also be implemented as a function. Your main function should have no more than 5 lines of code 3. 4. Demonstrate to the TA how your program works and plot the function in front of the TA using the values contained in the file "myFunctionTable.dat". You can use Gnuplot Online (http://gnuplot.respawned.com/) for plotting purpose Part II. In this exercise, you do nearly the same thing as in Part I, except that instead of prompting the user to enter information on the keyboard, the user must prepare an ASCII file (using any text editor, such as Notepad on Windows or pico/emacs on MacOS) containing all required information, and your program will get the user provided information from the file, computes the function values and write to the file "myFunctionTable.dat" The input file the user prepares should be named "input.dat". All four implementation requirements for Part I apply to this part. In fact, your main function should be exactly the same as that in Part I Demonstrate to the TA how you prepare the input file and the execution result of your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!