$20.99
In the previous lab task, you have done some coding on reading and writing to binary files. This week, you are going to explore the use of binary files using random access.
TASKS
You are required to write a program that maintains data about the amount of rainfall for a city using binary file. Each record should be saved into a struct with the following declarations:
struct Rainfall
{
char month[10];
int daysWithRain;
float avgRainfall;
};
Prompt the user to enter several records and saved them to the file. Then provide several options for the user to choose from:
§ Display the month with the highest average rainfall.
§ Display the month with the highest number of days with rain.
§ Display a particular record by prompting the record number from the user. Your program should directly access the record and display it to the user.
§ Display a particular record by prompting the month from the user.
The user should be allowed to repeatedly perform several operations on this file and the file should remain open until the user decided to terminate the program.