2006年江西财经大学专升本选拔考试试卷 
一、请按要求写出表达式(每小题4分,共16分)。 
1、设x和y分别表示两门课程的成绩,请写出一门是优秀且另一门不及格的逻辑表达式。优秀的要求是不低于90分,不及格是指低于60分。 
2、设str1和str2是两个字符数组名,请写出对这两个字符串进行逐个字符匹配的循环条件表达式。 
3、任意三个大于0的数a、b、c,写出判断a、b、c能构成三角形三条边的逻辑表达式。 4、设a、b、c、d分别表示4个学生某课程的成绩,请写出至少有一个学生的成绩在90分以上,且至少有一个学生的成绩在60分以下的逻辑表达式。 二、指出程序运行的输出结果 
2、#include    void main() { 
     char ch[2][10]={“6937”, “254”}, *p;      int i, sum; 
     for (i=0; i<2; i++) {         p=ch[i];         sum=0; 
        while (*p!=′\\0′) 
           sum=10*sum+*(p++)-?0?;         printf(“sum=%d\\n”, sum);      }   } 
3 #include    void fun() {       char c; 
      c=getchar(); 
      if (c=='$') printf(\      else {          fun(); 
         printf(\      }   } 
  void main() {       fun();   } 
输入:ABC$DEF(回车) 
三、程序填空题(每空2分,共20分) 1、找出三个字符串中的最小者。         void main() { 
      char str[20], s[3][20];  
- 1 - 
      int i;       )           gets(s[i]);       if (strcmp(  ①             strcpy(str, s[0]);       else 
          strcpy(  ②  );       if (strcmp(  ③             strcpy(str, s[2]); 
      printf(?The smallest string is: \\\\n?, str);   } 
2、下面的程序实现在一个非递减有序的数列中插入一个数,插入后数列仍然有序。请在空处填上适当表达式,使得程序能实现该功能。   #include    #define N 6   void main() { 
      int a[N+1]={7, 15, 24, 26, 30, 35}, i, x;       printf(“请输入一个整数:”);       scanf(“%d”, &x); 
      for (i=N-1; i>=0; i--) {          if (x            a[i+1]=  ①  ;          else  
              ②  ;       } 
      a[ ③ ]=x;       for (i=0; i3、递归函数invert实现按逆序重新放置数组中的元素,数组a中元素的值由主函数读入。   #include    #define N 10 
  void invert(int *p, int i, int j) {       int t;       if (i         invert(  ②  );       }   } 
  void main() {       int a[N], i;  
- 2 - 
      for (i=0; i         scanf(“%d”, a+ ③ );          ④    ; 
      for (i=0; i四、程序设计题(第1、3小题每题13分,第2小题20分,共46分) 
1、对一个整数,如果其所有因子(包括1在内)之和正好等于这个数,那么就称它为“完全数”,因子之和小于自身的数称为“亏数”;因子之和大于自身的数称为“盈数”。写一个函数,当其参数是亏数时返回负值,是完全数时返回0,是盈数时返回正值。利用这个函数求出1000以内的所有完全数。 
2、有4个学生5门课程的成绩存放在数组score[4][5]中,编写两个函数分别求第m个学生5门课程的平均成绩和第n门课4个学生的平均成绩,主函数中只实现数据的输入和输出,其中m和n的值也在主函数中输入。 
3、编写一个函数maxlong(char *str)。要求是:函数maxlong找出字符串str中包含的(第一个)最长单词,并输出。 #include 
void maxlong(char *str){  int pos=0,max=0,count=0,i=0;  while(str[i]){   if(str[i]==' '){    i++;   }   else    while(str[i]!='\\0'&&str[i]!=' ') {     count++;i++;    }    if(count>max) {     max=count;pos=i-count;count=0;    }    else count=0;  } 
    for(i=pos;ivoid main(){  char line[80];  gets(line);  maxlong(line); } 
 - 3 -