Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please explain 0000 T-Mobile 1:55 AM elearn.uta.edu 696 + 1. File Input/Output R

ID: 3682995 • Letter: P

Question

Please explain
0000 T-Mobile 1:55 AM elearn.uta.edu 696 + 1. File Input/Output Redirection Create a program that preforms the following steps to create a table of values by using a for loop from 0 to 10. a. Create a table of values as shown below. The values will be separated by a comma. (Remember to include math.h.) 1) x (can simply be your for increment integer) 2)x^2 3)e^x 4) 21x = exp2 (x) 5) nl (x) log (x) 6) log10 (x) 7) sqrt (x) 8) cbrt (x) pow (x ,2) exp (x) = = log10 (x) 10) cos (x*M PI/16) 11) sin (x*M PI/16) 12) tan (x M PI/16) i. Execute your program to verify it operates as expected Once you have it complete, record your code in a table within the template for your lab submission. ii. Record the results in another table for the test case. b. Redirect the output of your program to a file called "lab5partb.csv" by executing the program using the redirection operator (ie. type "a.out> lab5partb.csv at the command prompt. Open the file using n command. Verify that you get the same results and copy and paste the results in to a table in your submission for part b. ano or the more c. Copy "lab5partb.csv"to "lab5partc.csv" using the cp command in the omega unix account. i. Copy and modify your program from part a to increment from 11 to 100 and perform the same set of calculations. ii. Now redirect the output of your program by executing the following command a.out >> lab5partc.csv What did this do to the file? Record your answer in your lab submission. (You do not have to copy all the output just answer the question.)

Explanation / Answer

Question is to write code for calculating values of given above ten operations starting with 0 to 10 positive integer values.

And after getting results we have to write those output values to another file.(output.txt), so here in the above code they already kept some file operation functions directly (fprintf , fscanf..) and also the input values are also been stored in some file (i.e. input.txt) so we have to code on reading values from that file.

Heres the remaining code for program:

fprintf(fp2,"%f",log(x[count]));

fprintf(fp2,"%f",log10(x[count]));

fprintf(fp2,"%f",exp(x[count]));

fprintf(fp2,"%f",ldexp(x[count] ,1));

fprintf(fp2,"%f",sqrt(x[count]);

fprintf(fp2,"%f",cos(x[count]);

fprintf(fp2,"%f",sin(x[count]);

fprintf(fp2,"%f",tan(x[count]);

so thats how it goes. I didnt get what you want me to explain .. anyways I will tell few things about the above given code .. Program started with some declaration statements like declaring array x[ ] and file pointers fp1 and fp2 which are used to access files. fscanf and fprintf are file functions, where fscanf is used to read a file and fprintf is used to write to new file.

I hope you got it now.