【正文】
4)界面的美觀設(shè)計也是一個值得注意的問題,對使用者是否能順利使用軟件至關(guān)重要,所以界面的設(shè)計很重要,好的提示以及規(guī)則能避免很多不必要的錯誤。 if ((buf = (char*) realloc((void*)buf,size)) == NULL) merror(1)。) { buf[j] = 39。if ((buf = (char*) malloc(10)) == NULL) merror(0)。marks[j][2],amp。 break。 char *name。 marks[i+1]=temp1。students[j]!=NULL。 printf(student %s deleted from the class list\n,namex)。 } free((void*)studentsx[j])。 if (found) { for(i=0。 marksx=*marks。 int** marks1。SortClass(students1,marks1)。if ((students1[i] = (char*) malloc(strlen(name)+1)) == NULL) merror(7)。}/* do we have the student yet ? */for(found = i = 0。 students1[1] = NULL。marks1 = *marks。else if (menu == 3) ShowClass(students,marks)。}if (menu 1 || menu 5){ printf(incorrect selection)。char line[100]。void SortClass(char** students,int** marks)。刪除學(xué)生信息基本想法:先讀取要刪除的學(xué)生姓名,將讀入的學(xué)生姓名與已存在的學(xué)生進(jìn)行比較,如相同,記住該學(xué)生所在位置,判斷該學(xué)生下一個是否為空,若為空,就可以直接把該學(xué)生內(nèi)存釋放掉。完成函數(shù)void DeleteStudent(char*** students,int*** marks)。void SortClass(char** students,int** marks)。若不是,則用一個while 將后面的所有學(xué)生向前移一位 直到NULL,再釋放最后的內(nèi)存,最后再釋放學(xué)生姓名的那個內(nèi)存void SortClass(char** students,int** marks)。void ShowClass(char** students,int** marks)。int menu。 continue。else if (menu == 4) EditMarks(students,marks)。char *name。 if ((marks1 = (int**) malloc(2*sizeof(int*))) == NULL)merror(4)。 students1[i] != NULL。strcpy(students1[i],name)。*students = students1。 char* namex。/* do we have the student yet ? */for(found = i = 0。ij。//free key student39。 return。j++) { for(i=j。 } } }}/* function ShowClass *//*In this function you display on the screen eachstudent in the class and his/her 5 marks on a line.If the mark is 1 display a space instead. After thename of student display : and separate the marks by ,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 ShowClass(char** students,int** marks){ int i。 printf(Enter Student Name to be added marks in:\n)。 }}if (found) { printf(please input %s39。marks[j][3],amp。size = 10。\039。 continue??偨Y(jié):本次編程學(xué)習(xí)到了很多知識,特別感受到了鏈表在C語言中比數(shù)組來的更加方便,雖然完成了本次實習(xí)目的,但是設(shè)計出的軟件還有很大缺陷,不是很完善,在幾個地方不是很人性化,需要改進(jìn),比如在保存文件有累贅部分,有待完善。2)編程過程中出現(xiàn)的最多問題就是運行時總是跳出警告框提示內(nèi)存什么的,出現(xiàn)這個問題主要是寫代碼時候不嚴(yán)謹(jǐn),多處地方不能統(tǒng)一,導(dǎo)致機(jī)器運行是容易出錯,避免這種問題要仔細(xì)查看代碼任何一處地方,所有代碼都要遵守規(guī)則;3)在編寫過程中出現(xiàn)了很多問題,現(xiàn)挑主要問題說明如下:調(diào)用函數(shù)是,子函數(shù)沒有形參,調(diào)用時卻添加了形參;定義變量時沒有注意類型,在輸入時錯誤使用了輸入格式;一個子函數(shù)包含多一些語句時,容易漏掉大括號導(dǎo)致程序檢查時主函數(shù)出現(xiàn)錯誤;輸入的方法錯誤導(dǎo)致運行出錯;調(diào)用查找、修改函數(shù)不能進(jìn)入函數(shù)中,鏈表地址指向不對,語句放置位子不對;以上問題在老師的指導(dǎo)下,一個一個解決了,同時也給自己加深了編寫程序要注意的地方。) { size += 10。\n39。int i, j, size。marks[j][1],amp。 j=i。s reply using gets() into a character arrays of size 80.Then it uses sscanf() on that array to extract the response. Etc.for the third, fourth, and fifth.Note that both students and marks are passed to thisfunction by valu