亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      自考

      各地資訊
      當前位置:考試網(wǎng) >> 自考 >> 自考真題 >> 工學類 >> 高級語言程序設計(一) >> 文章內容

      排行熱點

      全國2011年1月高等教育自學考試高級語言程序設計(一)真題_第6頁

      來源:考試網(wǎng)  [2011年4月23日]  【

      四、程序填充題(本大題共3小題,每小題6分,共18分)

      請將下列程序橫線處缺少的部分補上,使其能正確運行。

      30.將數(shù)組a中元素按下圖循環(huán)左移一位并輸出。

      a[0]    a[1]    a[2]      a[3]    a[4]

      執(zhí)行前

      1

      2

      3

      4

      5

      執(zhí)行后

      2

      3

      4

      5

      1


      # include <stdio.h>

      void main ( )

      {  int j,k,a[5]={1,2,3,4,5};

      k=a[0];

      for(j=0;j<5;j++)

      a[j]=______;/*第一空*/

      a[4]=______;/*第二空*/

      for ( j=0;j<5;j++)

      printf (“%5d’’,_______);/*第三空*/

      printf (“\n’’);

      }

      31.計算并輸出1!+2!+3!+4!+5!的值。

      # include<stdio.h>

      int f (int a)

      {   static int c=1;

      c=c*a;

      return_____;/*第一空*/

      }

      void main ()

      {  int i,k;

      k=_________;/*第二空*/

      for (i=2;i<=5;i++) k+=f(________);/*第三空*/

      printf (“%d\n”,k);

      }

      32.將文本文件fin.dat中的數(shù)字字符找出并寫入文本文件fnum.dat中。

      #include<stdio.h>

      void main ()

      {

      char ch;FILE*fin,*fnum;

      fin=fopen (“fin.dat”,________);/*第一空*/

      fnum=fopen (“fnum.dat”,“w’’);

      while(!feof(_______))/*第二空*/

      {

      ch=fgetc(fin);

      if(______)fputc (ch,fnum);/*第三空*/

      }

      fclose (fin);

      fclose(fnum);

      }

      責編:Lisa