【正文】
yof the string with the name is placed there. Also the array marks isextended by one row (using realloc()) and all five marks in that row are set to 1. Then updated arrays students and marks are passed to SortClass()so they can be sorted alphabetically, as you are required to keep the classlist and the list of marks in alphabetical order.Note that both students and marks are passed to this function by reference,for this function on occasions must be able to modify the value stored in thepointer student (in main()) when putting there the very first student or whenrealloc() possibly moves the array in the memory somewhere else. The same appliesto marks.*/void InsertStudent(char*** students,int*** marks){int found, i。name = ReadLine()。 marks1[1] = NULL。 }}if (found) { printf(student %s already in the class list\n,name)。if ((marks1 = (int**) realloc((void*)marks1,sizeof(int*)*(i+2))) == NULL) merror(8)。t forget thatthe deleted string must be deallocated). Now deallocate the array studentsand make the pointer student point to the new array. As you can see we havethe same array of string as before, but with one string deleted. You mustdo the same with the array marks, for you must delete pletely dth row(so it did correspond to student[d] which we deleted).Note that both students and marks are passed to this function by reference,for this function on must be able to modify the value stored in the pointerstudent (in main()) when a student name is deleted. The same aplies to marks.*/void DeleteStudent(char*** students,int*** marks){ int found, i, j,a,b。 fflush(stdout)。 j=i。 } for(i=j。 free((void*)studentsx)。}}/* function SortClass *//*In this function you sort the strings in the array students alphabetically(lexicographically) using a simple bubble sort and the parison functionfor strings strcmp(). Do not forget that as you are changing the order ofstrings in students, you must be changing the order of rows in the arry marks.Note, that when sorting the array students, and when you want to switchith stringwith the (i+1)ststring, all you have to do is switch the pointers, you do nothave to touch the strings themselves.Note that both students and marks are passed to thisfunction by value, for this function does not need to modify thevalue stored in the pointer student. The same applies to marks.*/void SortClass(char** students,int** marks){ int i,j。 students[i]=students[i+1]。i++){ printf(%s,%d,%d,%d,%d,%d\n,students[i],marks[i][0],marks[i][1],marks[i][2],marks[i][3],marks[i][4])。 /* do we have the student yet ? */for(found = i = 0。\n,name)。}else {printf(wrong student name\n)。 i 10。amp。}/*end ReadLine*/四、程序調(diào)試(說明調(diào)試過程、問題及其解決方法) 這個函數(shù)中 我采用scanf這個函數(shù)來讀取成績,在讀取第五個成績的時候發(fā)現(xiàn)讀完后會在函數(shù)主菜單里出現(xiàn)一次的錯誤 這時我上網(wǎng)查了資料 發(fā)現(xiàn)應(yīng)該在第五個輸入成績的時候在%s后面再加一個%c 來吃掉一個回車鍵 這樣主菜單就不會出現(xiàn)菜單錯誤的情況 ,出現(xiàn)了很多失誤小錯誤,不過后來在老師和同學(xué)的幫助