题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-03 03:38:54

[填空题]下面函数返回数组中最大元素的下标,数组中元素个数为t,将程序补充完整。
int findmax(int s[],int t)
int k,p;
for(p=0,k=p;p<t;p++)
if 【9】
k=p;

return k;

更多"下面函数返回数组中最大元素的下标,数组中元素个数为t,将程序补充完整。"的相关试题:

[填空题]下面函数返回数组中最大元素的下标,数组中元素个数为t,将程序补充完整。 int findmax(int s[],int t) { int k,p; for(p=0,k=p;p<t;p++) { if 【9】 k=p; } return k; }
[填空题]下面函数返回数组中最大元素的下标,数组中元素个数为t,将程序补充完整。
int findmax(int s[],int t)
int k,p;
for(p=0,k=p;p<t;p++)
if
k=p;

return k;

[单项选择]主程序调用findmax函数求出数组中最大元素在数组中的下标,( )中需填写的内容是。
#include<stdio.h>
findmax(int*s,int t,int*k)
int p;
for(p=0,*k=p;p<t;p++)if(s[p]>s[*k])( );
main( )
int a[10],i,k;
for(i=0;i<10;i++)scanf("%d",&a[i]);
findmax(a,10,&k);
printf("%d%d/n" ,k,a[k]);
A. k=p
B. *k=p
C. k=p-s
D. *k=p-s
[单项选择]主程序调用findmax函数求出数组中最大元素在数组中的下标,括号中需填写的内容是
#include<stdio.h>
findmax(int*s,int t,int*k)
int p;
for(p=0,*k=p;p<t;p++)if(s[p]>s[*k])( );
main( )
int a[10],i,k;
for(i=0;i<10;i++)scanf("%d",&a[i]);
findmax(a,10,&k);
printf("%d%d/n" ,k,a[k]);
A. k=p
B. *k=p
C. k=p-s
D. *k=p-s
[单项选择]设函数int& index(int a,int i)返回数组a中下标为i的元素,如果在整型数组int array[]=1,2,3,在执行index(array,1)+=3后,array中各元素值为()。
A. 4,2,3
B. 1,5,3
C. 1,2,6
D. 4,5,6
[填空题]下的findrnax函数返M数组s中最大元素的下标。数组中元素的个数由t传入。 findmax(int s[],int t) {int k,p; for(p=0,k=0;p<t;p++) if(s[p]>s[k])______; return k: }
[简答题]请编写一个函数sum(int array[],int len),该函数返回数组array的所有整数元素的和,其中len为数组array的长度。 注意:部分源程序已存在文件test34_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数sum的花括号中填写若干语句。 程序输出结果如下: sum of array 15 文件test34_2.cpp的内容如下: #include <iostream.h> int sum(int array[],int len) { } void main( ) { static int a[5]-{1,2,3,4,5}; int result=sum(a,5); cout<<"sum of array "<<result<<end1; }
[单项选择]以下程序调用findmax函数返回数组中的最大值
findmax (inE *a,int n)
int*p,*s;
for(p=a,s=a;p-a<n;p++)
if(______)s=p;
return(*S);

main( )
int x[5]=12,21,13,6,18);
printf("%d/n",findmax(x’5));

在下划线处应填入的是
A. p>s
B. *p>*s
C. a[p]>a[s]
D. p-a>p-s
[填空题]以下程序调用findmax( )函数返回数组中的最大值。请填空完成此函数。 #include〈iostream〉 using namespace std; int findmax(int*a,int n) { int +p、*s; for(p=a,s=a;p-a〈n;p++) if(〈u〉 【8】 〈/u〉) *s=*p; return(*S); } int main( ) { int x[5]={12,21,14,16}; cout〈〈findmax(X,5)〈〈end1; return 0; }
[填空题]以下程序调用findmax( )函数返回数组中的最大值。请填空完成此函数。
#include〈iostream〉
using namespace std;
int findmax(int*a,int n)

int +p、*s;
for(p=a,s=a;p-a〈n;p++) if(〈u〉 【8】 〈/u〉)
*s=*p;
return(*S);

int main( )

int x[5]=12,21,14,16;
cout〈〈findmax(X,5)〈〈end1;
return 0;

[多项选择]【函数2.1说明】
递归函数sum(int a[], int n)的返回值是数组a[]的前n个元素之和。
【函数2.1】
int sum (int a[],int n)

if(n>0) return (1) ;
else (2) ;

【函数2.2说明】
有3个整数,设计函数compare(int a,int b,int c)求其中最大的数。
【函数2.2】
int compare (int a, int b, int c )
int temp, max;
(3) a:b;
(4) temp:c;

【函数2.3说明】
递归函数dec(int a[],int n)判断数组a[]的前n个元素是否是不递增的。不递增返回 1,否则返回0。
【函数2.3】
int dec( int a[], int n )

if(n<=1) return 1;
if(a[0]<a[1]) return 0;
return (5) ;

[简答题]请编写一个函数int fun(int *s,int t,int *k),用来求出数组的最大元素在数组中的下标并存放在k所指的存储单元中。
例如,输入如下整数:
876 675 896 101 301 401 980 431 451 777
则输出结果为6,980。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
int fun(int *s,int t,int *k)


main( )

int a[10]= 876,675,896,101,301,401,
980,431,451,777,k;
clrscr( );
fun(a, 10, &k);
printf("%d, %d/n ", k, a[k]);

[简答题]请编写一个函数int fun (int *s,int t,int *k),用来求出数组的最小元素在数组中的下标并存放在k所指的存储单元中。
例如,输入如下整数:
234 345 753 134 436 458 100 321 135 760
则输出结果为6,100。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<stdio.h>
int fun(int *s,int t,int *k)

main( )

int a[10]=234,345,753,134,436,458,
100,321,
135,760),k;
clrscr( );
fun(a,10,&k);
printf("%dr %d/n", k, a[k]);

[多项选择]编程题 请编写一个函数int fun(int *s,int t,int *k),用来求出数组的最小元素在数组中的下标并存放在k所指的存储单元中。 例如,输入如下整数: 234 345 753 134 436 458 100 321 135 760 则输出结果为6,100。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include #include int fun(int *s,int t,int *k) { } main( ) { int a[10]={234,345,753,134,436,458,100,321,135,760},k; clrscr( ); fun(a, 10, &k); printf("%d, %d/n ", k, a[k]); }
[简答题]请编写一个函数void fun(int p[],int n,int c),其中数组p的元素按由小到大的顺序排列,其元素个数为n。函数fun( )的功能是将c插入到数组p中,且保持数组的升序排列。
注意:部分源程序已存在文件PROC9.cpp中。
请勿修改主函数和其他函数中的任何内容,仅在函数fun( )的花括号中填写若干语句;
文件PROC9.cpp的内容如下:
//PROC9.cpp
#include <iostream>
#include <string>
using namespace std;
#define M 30
void fun(int p[ ],int n,int c);
int main ( )

int pp[M],n,i;
int fg, c;
cout<<"Please input n:/n";
cin>>n;
cout<<"Please input the n data:/n";
for (i=0; i<n; i++)
cin>>pp [i];
cout<<"Please input c:/n";
cin>>c;
fun (pp, n, c);
for (i=0; i<n; i++)
cout<<pp [i] << " " ;
cout<<end1;
return 0;

void fun(int p[ ],int n, int c)

//* * * * * * * * *

我来回答:

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

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码