欧美日韩不卡一区二区三区,www.蜜臀.com,高清国产一区二区三区四区五区,欧美日韩三级视频,欧美性综合,精品国产91久久久久久,99a精品视频在线观看

等級考試

計算機等級考試C語言沖刺題程序填空題

時間:2025-04-27 01:21:41 等級考試 我要投稿
  • 相關(guān)推薦

2014年計算機等級考試C語言沖刺題(程序填空題)

  沖刺題一

2014年計算機等級考試C語言沖刺題(程序填空題)

  請補充main()函數(shù),該函數(shù)的功能是:輸入兩個正整數(shù)numl和num2,求這兩個數(shù)的最大公約數(shù)和最小公倍數(shù)。

  例如,若輸人的兩個正整數(shù)為12,4,則它們的最大公約數(shù)為4,最小公倍數(shù)為12。

  注意:部分源程序給出如下。

  請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容,僅在main()函數(shù)的橫線上填入所編寫的若干表達式或語句。

  試題程序:

  #include

  #include

  void main()

  {

  int a,b,numl,num2,t;

  system(”CLS”):

  printf(”\nlnput tWO numbers:\n”);

  scanf(”%d,%d”,&numl,&num2);

  if(numl {

  a=num2;

  b=numl;

  }

  else

  {

  a=num1:

  b=num2:

  )

  while(【1】)

  {

  t=【2】

  a=b;

  b=t;

  }

  printf("greatest common divisor:

  %d\n”,a);

  printf(”least common multiple:

  %d\n”,【3】);

  沖刺題二

  請補充函數(shù)proc(),其功能是:計算并輸出給定10個數(shù)的方差。

  例如,拾定的10個數(shù)為12.0,9.0.26.0,5.0,6.0,31.0,9.0,3.0,8.0,18、0,輸出為s=8.8771500。

  注意:部分源程序給出如下。

  請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容,僅在函數(shù)proc()的橫線上填入所編寫的若于表達式或語句。

  試題程序:

  #include

  #include

  double proc(double xElO])

  {

  int i;

  double avg=0.0;

  double 8urn=0.0;

  double abs=0.0:

  double sd;

  for(i=0:i<10;i++)

  【1】 ;

  avg=sum/10;

  for(i=0;i<10;i十十)

  【2】 ;

  sd= 【3】 ;

  return sd;

  void main()

  {

  double s,str[10]={12.0,9.0,26.0,5.0,6.0,31.0.

  9.0,3.0,8.0,18.0);

  int i;

  printf(”\nThe original data is:\n”);

  for(i一0;i<10;i++)

  t)rintf(”%6.lf,slr[i]):

  printf(”\n\n”);

  s=proc(str):

  printf(”s=%f\n\n”,s);

  )

  沖刺題三

  請補充main()函數(shù),該函數(shù)的功能是:把一個字符串中的所有小寫字母字符全部轉(zhuǎn)換成大寫字母字符,其他字符不變,結(jié)果保存在原來的字符串中。

  例如,當(dāng)str[M]=”abcdefl23ABCD”,結(jié)果輸出:“ABC

  DEF123ABCD”。

  注意:部分源程序給出如下。

  請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容,僅在橫線上填入所編寫的若干表達式或語句。

  試題程序:

  #include

  #include

  #include

  #define M 80

  void main()

  {

  intj;

  char str[M]=" abcdefl23ABCD”;

  char *pf=str;

  system(”CLS”):

  printf(”***original string *** \n”):

  puts(str);

  【1】

  while(*(pf+j))

  {

  if(*(pf+j)>='a' &&*(pf+j)<='Z')

  {

  *(pf+j)=【2】 ;

  【3】 ;

  )

  else

  j++;

  )

  printf(”****new string****\n”);

  puts(str);

  system(”pause”);}

  沖刺題四

  str是一個由數(shù)字和字母字符組成的字符串,由變量num傳人字符串長度。請補充函數(shù)proc(),該函數(shù)的功能是:把字符串str中的數(shù)字字符轉(zhuǎn)換成數(shù)字并存放到整型數(shù)組1,b中,函數(shù)返回數(shù)組bh的長度。

  例如.str=”abc123de45f967”.結(jié)果為:1234567。

  注意:部分源程序給出如下。

  請勿改動main()函數(shù)和其他函數(shù)中的任何內(nèi)容.僅在函數(shù)proc()的橫線上填入所編寫的若干表達式或語句。

  試題程序:

  #include

  #define M 80

  int bb[M];

  int proc(char str[].int bh[],int num)

  {

  int i.n=0;

  for(i=0;i {

  if( 【1】 )

  {

  bb[n]=【2】;

  n++:

  )

  return 【3】 ;

  }

  void main()

  {

  char str[M];

  int num=0.n,i:

  printf(”Enter a string:n”);

  gets(str);

  while(str[num])

  num++o

  n=proc(str,bb,num);

  prinlf(”\nbb=”);

  for(i=0;i printf(”%d”,bb[i]);

  )

【計算機等級考試C語言沖刺題程序填空題】相關(guān)文章:

計算機等級考試二級C語言填空題09-09

2014年計算機等級考試C語言沖刺題(程序改錯題)10-24

計算機二級C語言上機程序填空題09-26

C語言經(jīng)典程序題09-17

計算機等級考試C語言程序設(shè)計選擇練習(xí)06-15

計算機二級C語言程序填空題練習(xí)題10-02

計算機二級C語言練習(xí)題:程序填空題09-14

計算機等級考試二級VB程序設(shè)計填空題06-25

計算機等級考試二級C語言真題09-26