Question: code in c. Just need lab4.c, need to get the same output lab4.c lab4.dat Write a program to compute the area of a parabola, with

code in c. Just need lab4.c, need to get the same output

code in c. Just need lab4.c, need to get the same outputlab4.c lab4.dat Write a program to compute the area of a parabola,with input data in one file, and output data in another file.

lab4.c

A file, lab4.c, is provided with some of the print statements in

lab4.dat

it. The formula we will use is: area = 2LD Where: area

Write a program to compute the area of a parabola, with input data in one file, and output data in another file. A file, lab4.c, is provided with some of the print statements in it. The formula we will use is: area = 2LD Where: area = the area of a parabola 3 L = the length of the opening D = the depth of the parabola INPUT/OUTPUT DESCRIPTION: The input will be a file called lab4.dat. Each line or record of the file will consist of two numbers: the length and depth of a parabola. Use an fscanf statement in a while loop to repeatedly get each set of values. The output will be a file, lab4.txt, showing on each line, the length, depth, and area of a parabola. ALGORITHM DEVELOPMENT: Open the data file lab4.dat and do the appropriate error checking Open the output file lab4.txt and do the appropriate error checking Print your name and the column header lines needed while ((fscanf(..., &length, $depth)) == 2) | Compute the area of the parabola | print the length, depth, and area. I Print a final empty line. Close the two files DEFINED OUTPUT APPEARANCE: (showing only 2 of the expected 4 lines) Ruthann Biel. Lab 4. Data on Parabolas Length Depth Area 12.60 5.60 24.80 7.80 208.320 29.120 REMINDERS Include your name and Lab 4 in your comment block, and in your output. All numeric variables are to be double. The formula has implied multiplication which in C means, we must use the Some printf and fprintf statements are included in lab4.c for you. WARNING - VIEWING OUTPUT When you run the program, it will seem like nothing is happening. That is because the whole thing is going to lab4.txt. /* Your Name /* Lab 4 /* Figure the area of a parabola using files */ #include #include #define IN_FILE_NAME "lab4.dat" #define OUT_FILE_NAME "lab4.txt" int main(void) { double length, depth, area; FILE *infile; FILE *outfile; fprintf(outfile, " Your Name. Lab 4. "); fprintf(outfile, "Data on Parabolas "); fprintfoutfile, " Length Depth Area fprintf(outfile, "); "); fprintf(outfile, " "); return EXIT_SUCCESS; It 12.6 24.8 5.6 7.8 7.85 12.61 8.9 4.7

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!