<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. 試題

    計算機二級C語言上機題庫及答案

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

    2017計算機二級C語言上機題庫及答案

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

      一、填空題

      給定程序中已建立一個帶有頭結點的單向鏈表,在main函數中將多次調用fun 函數,每調用一次fun函數,輸出鏈表尾部結點中的數據,并釋放該結點,使鏈表縮短。

      請在程序的下劃線處填入正確的內容并把下劃線刪除,使程序得出正確的結果。

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

      不得增行或刪行,也不得更改程序的結構!

      給定源程序:

      #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);

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

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人