题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-08-01 00:56:44

[填空题]fun( )函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最大的数,再求这N个最大值中的最小的那个数作为函数返回值。请填空完成此程序。 #define N 100 int fun(int (*A) [N]) { int row,col,max,min; for(row=0;row 【7】 ) max=a[row][col]; if(row==0) min=max; else if( 【8】 ) min=max; } return min; }

更多"fun( )函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最"的相关试题:

[填空题]fun函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最大数,再求这 N个最大值中的最小的那个数作为函数值返回。请填空______。
#include <stdio.h>
#define N 100
int fun(int(*a)[N])

int row, col,max,min;
for(row=0;row<N;row++)
for(max=a[row][0],col=1; col<N;col++)
if( ) max=a[row][col];
if(row==0) min=max;
else if( ) min=max;
return min;

[填空题]fun函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最大数,再求这N个最大值中最小的那个数并作为函数值返回。请填空。
#include <stdio.h>
#define N 100
int fun(int(*a)[N])
int row,col,max,min;
for(row=0;row<N;row++)
for(max=a[row] [0],col=1;col<N;col++)
if( 【13】 )max=a[row][col];
if(row==0)min=max;
else if( 【14】 )min=max;

return min;

[填空题]fun函数的功能是:首先对a所指的N行N列的矩阵,找出各行中的最大的数,再求这N个最大值中的最小的那个数作为函数值返回。请填空。
#include<stdio.h>
#define N 100
int fun(int(*a)[N])
int row,col,max,min;
for(row=0;row<N;row++)
for(max=a[row][0],col=1;col<N;col++)
if(______)max=a[row][col];
if(row==0)min=max;
else if(______)min=max;

return min;

[填空题]

fun( )函数的功能是首先对a所指的N行N列的矩阵,找出各行中的最大的数,再求这N个最大值中
的最小的那个数作为函数值返回,请填空。
  #include<stdio.h>
  #define N 100
  int fun(int( * a)[N])
  { in(row,col,max,min;
   for(row=0;row<N;row++)
    { for(max=a [row][0],col=1;col<N;col++)
     if( 【13】 )max=a[row][col];
     if(row= =0)min=max;
     else if( 【14】 )min=max;
    }
   return min;
  }


[填空题]

以下fun函数的功能是在N行M列的整型二维数组中,选出一个最大值作为函数值返回,请填空。(设M,N已定义)
int fun(int a[N][M])
{int i,j,row=0,co1=0;
for(i=0;i<N;i++)
for(i=0;j<M;j++)
if(a[i][j]>a[row][co1]){row=i;co1=j;}
return (12)
}


[填空题]下列给定程序中,函数fun( )的功能是:从s所指字符串中,找出t所指字符串的个数作为函数值返回。例如,当s所指字符串中的内容为abcdabfab,t所指字符串的内容为ab,则函数返回整数3。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构. 试题程序: #include <conio.h> #include <stdio.h> #include <string.h> int fun (char *s, char *t) {int n; char *p, *r; n=0; while(*s) {p=s; r=t; while (*r) /**************found**************/ if(*r==*p) {r++; p++} else break; /*************found**************/ if(r==’/0’) n++; s++; } return n; } main( ) {char s[100], t[100]; int m; clrscr( ); printf("/nPlease enter string s: "); scanf ("%s",s); printf("/nPlease enter substring t: "); scanf ("%s",t); m=fun (s,t); printf("/nThe result is: m=%d/n", m); }
[简答题]给定程序中函数fun的功能是:首先把b所指字符串中的字符按逆序存放,然后将a所指字符串中的字符和b所指字符串中的字符,按排列的顺序交叉合并到c所指数组中,过长的剩余字符接在c所指的数组的尾部。例如,当a所指字符串中的内容为“abcdefg”,b所指字符串中的内容为“1234”时,c所指数组中的内容应“a4b3c2dlefg”;而当a所指字符串中的内容为“1234”,b所指字符串的内容为“abcdefg”时,c所指数组中的内容应该为“lg2f3e4dcba”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <string.h>
void fun (char*a, char*, char *c)

inti, j; char ch;
i=0; j=strlen(b)-1;
/******************found*******************/
while(i>j)
ch=b[i]; b[i]=b[j]; b[j]=ch;
i++; j--;

while (*a|| *b)
/******************found*******************/
If(*a)
*c=*a; c++; a++;
if(*b)
*c=*b; c++; b++;

*c=0;

main( )

char s1[100], s2[100], t[200];
printf("/nEnter s1 string:"); scanf("%s", s1);
printf("/nEnter s2 string:"); scanf("%s", s2);
fun(s1, s2, t);
printf("/nThe result is: %s/n", t);

[填空题]下列给定程序中,函数fun( )的功能是:首先把b所指字符串中的字符按逆序存放,然后将a所指字符串中的字符和b所指字符串中的字符,按排列的顺序交叉合并到c所指数组中,过长的剩余字符接在c所指数组的尾部。例如,当a所指字符串中的内容为abcdefg,b所指字符串中的内容为1234时,c所指数组中的内容应该为a4b3c2dlefg;而当a所指字符串中的内容为1234,b所指字符串中的内容为abcdefg时,c所指数组中的内容应改为1g2f3e4dcba。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序 #include <conio.h> #include <stdio.h> #include <string.h> void fun(char *a, char *b, char *c) { int i, j; char ch; i=0; j=strlen(b)-1; /*************found**************/ while (i>j} {ch=bill; b[i]=b[j]; b[j]=ch; i++; j--; } while (*a||*b) { if (*a){*c=*a; c++; a++;} if(*b){*c=*b; c++; b++;} } /*************found**************/ *c=0 ; } main ( ) { char s1[100],s2[100],t[200]; clrscr( ); printf("/nEnter s1 string: "); scanf ("%s", s1); printf("/nEnter s2 string: "); scanf ("%s", s2); fun(s1,s2,t); printf("/nThe result is :%s/n",t); }
[简答题]

给定程序中,函数fun的功能是:判定形参a所指的N×N(规定N为奇数)的矩阵是否是"幻方",若是,函数返回值为1; 不是,函数返回值为0。"幻方"的判定条件是:矩阵每行、每列、主对角线及反对角线上元素之和都相等。
例如,以下3×3的矩阵就是一个"幻方":
4 9 2
3 5 7
8 1 6
请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构!
给定源程序:
#include
#define N 3
int fun(int (*a)[N])
{ int i,j,m1,m2,row,colum;
m1=m2=0;
for(i=0; i{ j=N-i-1; m1+=a[i][i]; m2+=a[i][j]; }
if(m1!=m2) return 0;
for(i=0; irow=colum= __1__;
for(j=0; j{ row+=a[i][j]; colum+=a[j][i]; }
if( (row!=colum) __2__ (row!=m1) ) return 0;
}
return __3__;
}
main( )
{ int x[N][N],i,j;
printf("Enter number for array:/n");
for(i=0; ifor(j=0; jprintf("Array:/n");
for(i=0; i{ for(j=0; jprintf("/n");
}
if(fun(x)) printf(&qu

[填空题]给定程序中,函数fun的功能是:判定形参a所指的NxN(规定N为奇数)的矩阵是否是“幻方”,若是,则函数返回值为1;若不是,则函数返回值为0。“幻方”的判定条件是:矩阵每行、每列、主对角线及反对角线上元素之和都相等。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#define N 3
int fun (int(+a)[N])
int i, j, m1, m2, row, colum;
m1=m2=0;
for(i=0; i<N; i++)
j=N-i-1; m1+=a[i][i];
m2+=a[i][j];
if(m1!=m2) return 0;
for(i=0; i<N; i++)
/******************found*******************/
row=colum= (1) ;
for(j=0; j<N; j++)
row+=a[i][j]; colum+=a[j][i];
/******************found*******************/
if(row!=colum) (2) (row!=m1)) return 0;

/******************found*******************/
return (3) ;

main( )
int x[N][N], i, j;
printf("Enter number for array:/n");
for(i=0; i<N; i++)
for(j=0; j<N; j++)
scanf("%d", &x[i][j]);
printf("Array:/n");
for(i=0; i<N; i++)
for(

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码