【正文】
(8分)/location){/location){。(10分)(2)設計一組測試用例,盡量使main 函數(shù)的語句覆蓋率能達到100% 。 return head。 p1 = (list_pointer) malloc(sizeof(list_node))。 p2link = p1。t)。 for(i = 0。 p1= p2= (list_pointer) malloc(sizeof(list_node))。 printf(please input the data for the link node:\n)。length)。 printf(please input the node number of the link:\n)。}//根據(jù)用戶的輸入數(shù)值建立一個新的單向鏈表:list_pointer create(){ int i, current, length。choose)。 } printf(please input your choice\n)。 default: break。 print(ptr)。 case 3: printf(you will invert the link\n)。 print(ptr)。 } node = traillink。 while(ilocation){ trail = traillink。 trail = ptr。 node = ptr。 scanf(%d, amp。 case 2: printf(you will delete a node from the link\n)。 /* p為指向ptr的指針 */ print(ptr)。 i++。 i = 1。location)。 printf(please input the location of the node:\n)。choose)。 printf(please input your choice\n)。 printf(input number 2, you can delete a node from the link\n)。 //根據(jù)用戶的不同選擇進行相應的操作: printf(input number 0, you can quit the program\n)。 //建立一個單向鏈表: ptr=create()。 int choose, location, i。 list_pointer *p = amp。 //反轉鏈表int main(){ list_pointer ptr=NULL。 //刪除前一個節(jié)點是trail的當前節(jié)點nodevoid print(list_pointer ptr)。