Question: Problem 3: Structures and Files (65 Points] You are asked to write a C program to store records for patients. A. First, you need to

 Problem 3: Structures and Files (65 Points] You are asked towrite a C program to store records for patients. A. First, you

Problem 3: Structures and Files (65 Points] You are asked to write a C program to store records for patients. A. First, you need to define a structure called PATIENT. This structure should have the following fields: name (string) and age (float). [5 points] // write the structure here B. Write a function fillArray that takes as input an array of structures of type PATIENT, and the size of the array (the size will be entered by the user in the main). The function asks the user for the necessary information, and stores them in the array. (15 points) void fillArray (PATIENT* Ary, int N) { // Write your code here C. Write a function SaveAdults that takes as input the array of patients and its size N, and copies all the information of adult patients (age is greater than or equal to 18) to a file named "Adults_data.txt". Of course, you have to open the file first in the correct mode. [25 points) void SaveAdults (PATIENT* Ary, int N) { // Write your code here D. In the main: a. Dynamically allocate an array of structures of type PATIENT. Note that the size N of the allocated array should be entered by the user. [15 points] b. Call the functions fillArray, then SaveAdults. [5 points] int main() { PATIENT * Ary; int N, 1; // Get N and dynamically allocate memory for the array. Check if memory successfully allocated. 1/ Call the functions fillArray, then SaveAdults return 0; }

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!