2013年计算机二级C语言上机题库三

考试站(www.examzz.com)   【考试站:中国教育考试第一门户】   2013年2月26日

为方便广大考生查找考试辅导习题及更好的学习。网校(www.examzz.com)特提供2013年计算机二级C语言考试上机预测题(包括填空题、改错题、编程题),作为参考希望能帮到各位考生。

填空题
  请补充函数FUN(CHAR *S),该函数的功能是把字符串中的内容逆置.
  例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容为edcba.
  请勿改动主函数main和其他函数中的任何内容,仅在fun函数的横线上填入所编写的若干表达式或语句。
  试题程序:
  #include
  #include
  #include
  #define N 81
  void fun(char *s)
  {
  int i, n = strlen(s)-1;
  char t;
  for (i=0; i  {
  t = s[i];
  ___2___;
  ___3___;
  }
  }
  main()
  {
  char a[N];
  printf("Enter a string:");
  gets(a);
  printf("The original string is:");
  puts(a);
  fun(a);
  printf("\n");
  printf("The string after modified:");
  puts(a);
  }
  第1处填空:n--或--n或n-=1或n=n-1
  第2处填空:s[i]=s[n]或*(s+i)=*(s+n)
  第3处填空:s[n]=t或*(s+n)=t


首页 1 2 3 尾页

相关文章