freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

編程實習(xí)報告09061109-楊宇超(編輯修改稿)

2024-08-30 07:35 本頁面
 

【文章內(nèi)容簡介】 *//*This function prompts the user to enter a student nameto be precise form of the prompt is Enter Student Name to be deleted from Class List:Then this function reads the name from standard input.But it must be able to read any name of any size!! Thus you haveto allocate memory (using malloc()) to read the input into, and ifit is not big enough, must use realloc() to extend it. You are notallowed to allocate more than 10 bytes in one allocation or extendyour segment by more than 10 bytes in one call to realloc().Do not forget to deallocate the memory before exiting the function!Note that this part of the code is the same as in InsertStudent(),so you can either copy it or write a function that would do it for both.Once the function has the name to be deleted, it traverses the arraystudent to find out if it is there. If not, a warning message isdisplayed student xxx not in the class list and the function terminates.If it is found (say its is students[d]), a dynamic onedimensional array oneitem shorter than students is created and the strings from the array studentsare unhooked from the arrays students and hooked to the new array with theexception of the string to be deleted (don39。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。 char** studentsx。 int** marksx。 char** students1。 int** marks1。 char* namex。 char* name。 printf(Enter Student Name to be deleted from Class List:\n)。 fflush(stdout)。 name = ReadLine()。 namex=name。 studentsx=*students。 marksx=*marks。/* do we have the student yet ? */for(found = i = 0。 studentsx[i] != NULL。 i++) { if (strcmp(studentsx[i],name) == 0) { found = 1。 j=i。 }} b=i。 /*give groop space*/ students1 = (char**) malloc((b+1)*sizeof(char*))。 marks1 = (int**) malloc((b+1)*sizeof(int*))。 if (found) { for(i=0。ij。 i++){ students1[i]=studentsx[i]。 marks1[i]=marksx[i]。 } for(i=j。ib。 i++){ students1[i]=studentsx[i+1]。 marks1[i]=marksx[i+1]。 } free((void*)studentsx[j])。//free key student39。name。 free((void*)marksx[j])。 free((void*)studentsx)。 free((void*)marksx)。 *students=students1。 *marks=marks1。 printf(student %s deleted from the class list\n,namex)。 return。} /* so it
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1