摘要:试题一[函数1.1说明]函数strcmp()是比较两个字符串s和t的大小。若s<t函数返回负数;若s=t函数返回0;若s>t,函数返回正数。[函数1.1]intstrcmp(char*s,char*t){while(*s&&*t&&__(1)__){s++;t++;}return__(2)__;}[程序1.2说明]在n行n列的矩阵中,每行都有最大的数,本程序求
试题一
[函数1.1说明]
函数strcmp()是比较两个字符串 s 和 t 的大小。若 s < t 函数返回负数;若 s = t 函数返回0;若 s > t,函数返回正数。
[函数1.1]
int strcmp(char *s,char *t)
{ while ( *s && *t && __(1)__){
s++;t++ ;
}
return __(2)__;
}
[程序1.2说明]
在 n 行 n 列的矩阵中,每行都有最大的数,本程序求这 n 个最大数中的最小一个。
[程序1.2]
#include〈stdio.h〉
#define N 100int a[N][N];
void main()
{ int row ,col ,max ,min ,n;
/*输入合法 n (〈100 ),和输入 m ×n 个整数到数组 a 的代码略*/
for ( row = 0;row < n;row++) {
for ( max = a[row][0],col = l ;col < n;col++)
if (__(3)__) max = a[row][col];
if (__(4)__) min = max;
else if(__(5)__) min = max;
}
printf ("The min of max numbers is %d\n",min);
}
软考备考资料免费领取
去领取