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

正文內(nèi)容

編程實習(xí)報告09061109-楊宇超-在線瀏覽

2024-09-13 07:35本頁面
  

【正文】 to allocate more than 10 bytes in one allocation orextend your segment by more than 10 bytes in one call to realloc().Do not forget to deallocate the memory before exiting the function!Once the function has the name to be entered, it traverses the array studentto find out if the name is already there. If so, the function displaysa warning message student xxx already in the class list and terminates (where xxx is the name of the student). If the name is not in the array, thearray students is extended by one item (using realloc()) and a copyof 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。int** marks1。marks1 = *marks。printf(Enter Student Name to be added to Class List:\n)。name = ReadLine()。 if ((students1[0] = (char*) malloc(strlen(name)+1)) == NULL)merror(3)。 students1[1] = NULL。 if ((marks1[0] = (int*) malloc(5*sizeof(int))) == NULL)merror(5)。 marks1[1] = NULL。 *marks = marks1。}/* do we have the student yet ? */for(found = i = 0。 i++) { if (strcmp(students1[i],name) == 0) { found = 1。 }}if (found) { printf(student %s already in the class list\n,name)。} /* so it is not in the class list yet */students1 = (char**) realloc((void*)students1,(i+2)*sizeof(char*))。if ((students1[i] = (char*) malloc(strlen(name)+1)) == NULL) merror(7)。students1[i+1] = NULL。if ((marks1 = (int**) realloc((void*)marks1,sizeof(int*)*(i+2))) == NULL) merror(8)。marks1[i][0]=marks1[i][1]=marks1[i][2]=marks1[i][3]=marks1[i][4]=0。SortClass(students1,marks1)。*marks = marks1。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。 int** marksx。 int** marks1。 char* name。 fflush(stdout)。 namex=name。 marksx=*mark
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1