题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-11 01:45:23

[多项选择]编程题 请编写一个函数void fun(int m, int k, int xx[]),该函数的功能是:将大于整数m且紧靠m的k个非素数存入所指的数组中。 例如,若输入15,5,则应输出16,18,20,21,22。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include #include void fun(int m, int k, int xx[]) { } main( ) { int m,n,zz[1000]; clrscr( ); printf("/nPlease enter two integers: "); scanf("%d%d",&m,&n); fun(m, n, zz); for(m=0;m

更多"编程题 请编写一个函数void fun(int m, int k, "的相关试题:

[简答题]请编写一个函数void fun(int m, int k, int xx[]),该函数的功能是将大于整数m且紧靠m的k个非素数存入所指的数组中。
例如,若输入15,5,则应输出16,18,20,21,22。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
void fun(int m,int k,int xx[])

main( )

int m,n,zz[1000];
clrscr( );
printf("/nPlease enter two integers:");
scanf("%d%d",&m,&n);
fun(m,n,zz);
for(m=0;m<n;m++)
printf("%d",zz[m]);
printf("/n");

[简答题]请编写一个函数void fun(int aa[],int n,int x),其中n表示数组aa中元素的个数,函数的功能是:计算前x项的和并放在aa[x]中,aa数组中的元素值和x的值由主函数通过键盘读入。
注意:用循环和数组实现。
部分源程序已存在文件PROC3.cpp中。请勿修改主函数和其他函数中的任何内容,
仅在函数resort( )的花括号中填写若干语句。
文件PROC3.cpp中的程序清单如下:
//PROC3.CPP
#include <iostream>
using namespace std;
#define MAX 100
int main ( )

void fun(int aa[],int n, int x);
int bb[MAX],i,x,n;
cout<<"Please enter the counter of the number:/n";
cin>>n;
cout<<"Please enter the number:/n";
for(i=0;i<n;i++)
cin>>bb[i];
cout<<"Input the x:/n";
cin>>x;
fun(bb, n,x);
cout<<"The data after total: "<<bb[x]<<end1;
return 0;

void fun(int aa[],int n, int x)

//*********

[简答题]请编写一个函数void fun(int a [],int n),其中a为数组,n为数组a的长度。函数fun( )的功能是冒泡排序法将数组a元素按从小到大的顺序排列,实现数组a的升序排列。
注意:部分源程序已存在文件PROC12.cpp中。
请勿修改主函数和其他函数中的任何内容,仅在函数fun( )的花括号中填写若干语句。
文件PROC12.cpp的内容如下:
//PROC12. cpp
#include <iostream>
using namespace std;
#define MAX 100
void fun(int a[],int n);
int main ( )

int a[MAX],n,i;
cout<<"Please enter the array size n:/n";
do
cin>>n;
if (n>100)
cout<<"array size flowover! ReEnter a number(0-100)/n";
while (n>100);
cout<<"Enter the array data:/n";
for (i=0; i<n; i++)
cin>>a [ii;
fun(a[],n);
for (i=0; i<n; i++)
cout<<a [i] <<" ";
cout<<end1;
return 0;

void fun(int a[ ],int n)

// * * * * * * * *

[简答题]请编写一个函数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)

//* * * * * * * * *

[简答题]请编写函数void fun (int x,int pp[],int *n),它的功能是求出能整除x且不是奇数的各整数,并按从小到大的顺序放在pp所指的数组中,这些除数的个数通过形参n返回。
例如,若x中的值为24,则有6个数符合要求,它们是2, 4, 6, 8, 12, 24。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<stdio.h> void fun(int x,int PP[],int *n)
main ( )

int x,aa[1000],n,i;
clrscr( ) ;
printf("/nPlease enter an integer number:
/n ") ;
scanf("%d",&X);
fun(x,aa,&n);
for(i=0;i<n;i++)
printf("%d",aa[i]);
printf("/n");

[简答题]请编写函数void swap(int *px,int *py)与void swap(int &px,int &PY),实现主程序中变量a和b值的交换。 输出结果如下: 3 2 2 3 注意:部分源程序已存在文件test5_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数相应的花括号中填写若干语句。 文件test5_2.cpp的内容如下: #include<iostream.h> void swap(int *px,int *py) { /***1***/ } void swap(int &px,int &PY) { /***2**/ } void main( ) { int a=2,b=3; swap(a,b); cout<<a<<" "<<b<<endl; swap(&a,&b); cout<<a<<" "<<b<<endl; }
[简答题]请编写一个函数void fun(cbara [], charb [], int n),其功能是:删除一个字符申中指定下标的字符。其中,a指向原字符串,删除后的字符串存放在b所指的数组中,n中存放指定的下标。
例如,输入一个字符串world,然后输入3,则调用该函数后的结果为word。
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
# include <stdio.h>
# include <conio.h>
# define LEN 20
void fun (char a[], char b [], int n)


main ( )

char str1 [LEN], str2 [LEN];
int n ;
clrscr ( );
printf ("Enter the string : /n") ;
gets (str1) ;
printf ("Enter the position of the string
deleted: ");
scanf ("%d", &n) ;
fun (str1, str2, n) ;
printf ("The new string is : %s /n",
str2) ;

[多项选择]简单应用题 请编写两个函数void sort(int &x, &y)和void sort(int x,int y,int z),实现对2个和3个元素的排序并在屏幕上输出排序结果(数字之间使用跳格)。 注意:部分源程序已存放在文件test2_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数的花括号中填写若干语句。 输出结果如下: 3 4 2 3 4 文件test2_2.cpp的内容如下: #include void sort(int &x,int &y) { /**1**/ } void sort(int x,int y,int z) { /**2**/ } void main( ) { int a=4,b=3,c=2; sort(a,b); sort(a,b,c); }
[多项选择]简单应用题 请编写函数void swap(int *px,int *py) 与void swap(int &px,int &py),实现主程序中变量a和b值的交换。 输出结果如下: 3 2 2 3 注意:部分源程序已存在文件test5_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数相应的花括号中填写若干语句。 文件test5_2.cpp的内容如下: #include void swap(int *px,int *py) { /***1***/ } void swap(int &px,int &py) { /***2***/ } void main( ) { int a=2,b=3; swap(a,b); cout<
[多项选择]简单应用题 请编写一个函数void swap(int *x,int *y),用来交换两个数的值。 注意:部分源程序已存在文件test14_2.cpp中。 请勿修改主函数main和其他函数中的任何内容,仅在函数swap的花括号中填写若干语句。 文件test14_2.cpp的内容如下: #include void swap(int *x,int *y); void main( ) { int a=1,b=3; swap(&a,&b); cout<<"a="<查看答案

我来回答:

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

订单号:

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