2014年计算机二级C语言考试上机模拟试题(1)_第7页

考试站(www.examzz.com)   【考试站:中国教育考试第一门户】   2014年2月10日
四、程序设计题(共18分)  
  编写一个函数,从传人的M个字符中找出最长的一个字符串,并通过形参指针max传回该串地址(用****作为结束输入的标志)。  
  注意:部分源程序给出如下。  
  请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填人所编写的若干语句。  
  试题程序:  
      #include  
      #include  
      #include  
      char*proc(char(*a)[81],int num)  
      {  
      )  
      void main()  
      {  
      char ss[l0][81],*max;  
      int n,i=0;  
      printf("输入若干个字符串:");  
    gets(ss[i]);  
    puts(ss[i]);  
    while(!strcmp(ss[i],"****")= =0)  
    {  
      i++:  
      gets(ssEi]);  
      puts(ss[i]);  
    )  
    n=i:  
    max=proe(SS,n);  
    printf("\nmax=%s\n",max);  
  } 

相关文章