Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
lab4.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. 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 */ #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started