Give a text file named Holidays.txt with the data format as following:
0101 New Year’s Day
1001 National Day
…
Which includes MAX lines, and you can define the MAX at the begin of your program, assume each line includes less than 100 characters.
(1) Write a function getHolidays(char* filename, char holidayList[MAX][100]) that reads the list of holidays from the file Holidays.txt to the string array holidayList, then displays the current list of holidays. If the Holidays.txt file is not existed, just create the file in your program. The getHolidays() function should return the actual size of the holidays list.
(2) Write a function named sortList(char (*holidayList) [100], int listLength) to sort the holidays in ascending order.
(3) In main() function, first calls getHolidays() to get list of holidays, and displays the current list of holidays, then show the user-choice list. The user can add or delete a holiday, or quit the program according the choice.
(4) When the user selects add or delete a holiday, after the holidays have been modified, the program should calls the sortList() and then display the new list.
(5) When the user selects quit, if the holiday has been modified anyway, the program should ask the user whether the new list should be saved; if the user responds affirmatively, the function should write the new data to the existing Holidays.txt file, overwriting the contents of the existing file.
http://www.cplusplus.com/reference/cstdio/FILE/
也是cxd作业吗,插眼