Question: This HW#5 there has to be 2 programs. this is HW#5 #include #include #include typedef struct record{ int t; float tp, tf, tt; } record;

 This HW#5 there has to be 2 programs. this is HW#5

#include #include #include typedef struct record{ int t; float tp, tf, tt;

} record; void populateArray(record **arr, int size) { int i; for(i=0; it

This HW#5

= i-10; arr[i]->tp = rand() %200 + 500; arr[i]->tf = rand()%50 +

10; arr[i]->tt = rand()%10 + 20; } } void printChangeInPress(record **arr, int

there has to be 2 programs.

this is HW#5

#include #include #include

typedef struct record{ int t; float tp, tf, tt; } record;

void populateArray(record **arr, int size) { int i; for(i=0; it = i-10; arr[i]->tp = rand() %200 + 500; arr[i]->tf = rand()%50 + 10; arr[i]->tt = rand()%10 + 20; } }

void printChangeInPress(record **arr, int size) { int i = 0; for(i=0; itp - arr[i+1]->tp) > 100) { break; } } printf("The records after a difference of pressure of 100 psi: "); int count = 0, k; for(k=i; countt ,r->tp ,r->tf ,r->tt); if(k == size-1) { k = -1; } count++; } }

int main() { srand(time(NULL)); record ** arr = (record **) malloc(21 * sizeof(record*));

populateArray(arr, 21);

printChangeInPress(arr, 21); }

1170%1 1 :23 PM KHw6-3223-Fa. : Homework Assignment #6 Course: COP 3223C-Intro to Programming with C Semester: Fall 2017 Credit Value: 4% of Final Grade Due Date: November 20, 2017 You changed your mind about how to output the results of your transmogrifier monitoring system. Instead of printing out the output to the screen, which is rather useless, you have brilliantly decided to write the results out to a file on the hard drive. That way, the results can be made part of the permanent record and can be easily shared among interested parties. The latter was hard to do when it merely printed the results out to screen. However, your boss said that she wants to see the output on his screen, but she happens to be a techno-retard and doesn't know how to handle files. Imagine that! So, you will write a second program (not another function to the old program, but rather a completely separate program) that reads the results from the file and prints the output to screen. You can assume a known name for the file and hardcode it in the second program so the user doesn't have to enter the name of the file to be written to or read. You can call it output-data.txt. So, take the program you wrote for HW #5 and modify it to do the following 1) The printout function should now print out to output-data.txt. Take out all code that prints to screen, but save it because you are going to use it for step 2 below. That's it for the Hww5 program-nothing else 2) Write a second program (i.e., NOT a function in the first program!) that reads the data from output-data.txt and prints it out to screen. You can do this in one of two ways a) print each row as it is read from the file; or preferably, b) populate an array in the printout function that holds the values read from the file and then print from this array to screen. The first is more efficient;the second is more elegant and organized Submission instructions Submit your program source code for each of the two programs as .c files through the Webcourses homework submission page o DO NOT email it to me or to the TAs! It won't count. o DO NOT submit the project file!!! o Do not submit output-data.txt. Your program 1 should be able to generate it. Please name the files as HW6 -part 1.c and HW6 -part 2.c Put your full name and ID number as the first two comment lines in the program source code

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!