更多"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( 【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])
{ 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______;
[填空题]给定程序中,函数fun( )的功能是找出N×N矩阵中每列元素中的最大值,并按顺序依次存放于形参b所指的一维数组中。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
#include<stdio.h>
#define N 4
void fun(int(*a)IN],int *b)
int i,j;
for(i=0;i<N;i++)
/**********found**********/
b[i]= (1) ;
for(j=1;j<N;j++)
/**********found**********/
if(b[i] (2) a[j][j])b[i]=a[j][j];
main( )
int x[N][N]=12,5,8,7,6,1,9,3,1,2,3,4,2,8,4,3,y[N],i,j;
printf("/nThe matrix:/a");
for(i=0;i<N;i++)
for(j=0;j<N;j++)printf
("%4d",x[i][j]);
printf("/n");
/**********found**********/
fun (3) ;
printf("/nThe result is:");
for(i=0;i<N;i++)printf("%3d",y[i]);
printf("/n");
[填空题]下列给定程序中,函数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( )的功能是:从s所指字符串中,找出与t所指字符串相同的子串的个数作为函数值返回。例如,当s所指字符串中的内容为”abcdabfab”,t所指字符串的内容为”ab”,则函数返回整数3。
请改正程序中的错误,使它能得出正确的结果。
#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)
if(*r==*p)
/**********found**********/
r++;p++
else break;
/**********found**********/
if(r==’/0’)
n++;
s++;
return n;
main( )
char s[100],t[100];int m;
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);