Simple code Assignment

FIND A SOLUTION AT Academic Writers Bay

Simple code Assignment. [prob1.c][100%] Develop a C program to read hurricane data and store and sort those hurricane data.
Each hurricane record contains the hurricane’s name, year, month, and category. An input file named
“hurricane.txt” contains 100 hurricane records. Your program will perform the following tasks.
a) Read hurricane data from input file “hurricane.txt” and store them in an array of structures. The structure definition is shown below. Then write the hurricane data stored in the array of structure
to a binary file named “hurricane.bin”.
typedef struct hurricanechar name[20];
int year;
int month;
int category;
Simple code Assignment b) Create a new structure for storing the same hurricane data. This new structure should contain the
same members (name, year, month, and category) but utilize a minimum size as a data type.
Take the definition of the new structure shown below as an example. Design this new structure
so that the value size of(H_RECORD_MIN) is minimized. Read hurricane data from input file
“hurricane.txt”, store them in an array of this new structure, and write the hurricane data stored
in the array of a new structure to a binary file named “hurricane_min.bin”.
typedef struct hurricane_min…
[Hint: examine the range required for each member and modify their data type/size.]
c) Display on the screen the file sizes of “hurricane.txt”, “hurricane.bin”, and “hurricane_min.bin”.
[Hint: you can use f seek() and f tell().]
d) Read hurricane from input file “hurricane.txt”, store them in an array of structure, sort the
hurricane data by its category from minimum to maximum, and write the sorted hurricane data to
a text file named “hurricane_sort.txt”. In the output file “hurricane_sort.txt”, category-1
hurricanes will appear first, then category-2 hurricanes, category-3 hurricanes, and so on.
A template source code is provided. In the template, the main() function first calls Setup() to
generate the input file named “hurricane.txt”. Then the main() function calls DisplayMax()
that displays on the screen all hurricanes of the maximum category. Then the main() function calls the
following four functions (in order):
 SaveBinFile() performing task a), generating “hurricane.bin”
 SaveBinFileMin() performing task b), generating “hurricane_min.bin”
 DisplayFileSize() performing task c), accessing “hurricane.txt”, “hurricane.bin”,
 SaveSortTxt() performing task d), generating “hurricane_sort.txt”
The template compiles correctly with warnings of unused variables, which should disappear once
you use those variables in your code. The flow of the program and the input and output file names
are all set up properly. DisplayMax() provides an example of reading hurricane records and
storing them in an array of structures. You can complete this program by “filling the blanks” inside
the function definitions. Only insert your code inside the definitions of the aforementioned four
functions. No modifications should be done to any other part of the template source code.
In your report, describe in detail what your functions do and your implementation details. You can also
include your source code in your report in case your source code submission on Blackboard encountered
unexpected difficulties. However, you must submit your source code file (.c), not just Word or PDF
document containing the source code. Simple code Assignment

YOU MAY ALSO READ ...  Olympic Committee
Order from Academic Writers Bay
Best Custom Essay Writing Services