亚洲一级免费看,特黄特色大片免费观看播放器,777毛片,久久久久国产一区二区三区四区,欧美三级一区二区,国产精品一区二区久久久久,人人澡人人草

試題

計算機(jī)二級C語言上機(jī)題庫及答案

時間:2025-01-20 09:03:13 試題 我要投稿

2017計算機(jī)二級C語言上機(jī)題庫及答案

  我們將要迎來計算機(jī)考試,大家準(zhǔn)備好了嗎,以下是小編分享給大家的2017計算機(jī)二級C語言上機(jī)題庫及答案,歡迎測試!

  一、填空題

  給定程序中已建立一個帶有頭結(jié)點(diǎn)的單向鏈表,在main函數(shù)中將多次調(diào)用fun 函數(shù),每調(diào)用一次fun函數(shù),輸出鏈表尾部結(jié)點(diǎn)中的數(shù)據(jù),并釋放該結(jié)點(diǎn),使鏈表縮短。

  請在程序的下劃線處填入正確的內(nèi)容并把下劃線刪除,使程序得出正確的結(jié)果。

  注意:源程序存放在考生文件夾下BLANK1.C中。

  不得增行或刪行,也不得更改程序的結(jié)構(gòu)!

  給定源程序:

  #include

  #include

  #define N 8

  typedef struct list

  {int data;

  struct list *next;

  }SLIST;

  void fun(SLIST *p)

  {SLIST *t, *s;

  t=p->next; s=p;

  while(t->next != NULL)

  {s=t;

  /**********found**********/

  t=t->___1___;

  }

  /**********found**********/

  printf(" %d ",___2___);

  s->next=NULL;

  /**********found**********/

  free(___3___);

  }

  SLIST *creatlist(int *a)

  {SLIST *h,*p,*q; int i;

  h=p=(SLIST *)malloc(sizeof(SLIST));

  for(i=0; i

  {q=(SLIST *)malloc(sizeof(SLIST));

  q->data=a[i]; p->next=q; p=q;

  }

  p->next=0;

  return h;

  }

  void outlist(SLIST *h)

  {SLIST *p;

  p=h->next;

  if (p==NULL) printf(" The list is NULL! ");

  else

  {printf(" Head");

  do {printf("->%d",p->data); p=p->next;}while(p!=NULL);

  printf("->End ");

  }

  }

  main()

  {SLIST *head;

  int a[N]={11,12,15,18,19,22,25,29};

  head=creatlist(a);

  printf(" Output from head: "); outlist(head);

  printf(" Output from tail: ");

  while (head->next != NULL){

  fun(head);

  printf(" ");

  printf(" Output from head again : "); outlist(head);

  }

  }

  解題答案:

  /**********第一空**********/

  t=t->next;

  /**********第二空**********/

  printf(" %d ",t->data);

  /**********第三空**********/

  free(t);

  ******************************************