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

[简答题]请编一个函数float fun (double h),函数的功能是对变量h中的值保留两位小数,并对第三位进行四舍五入(规定h中的值为正数)。 例如:若h值为8.32433,则函数返回8.32:若h值为 8.32533,则函数返回8.33。 注意:部分源程序给出如下。 请勿改动主函数main 和其他函数中的任何内容,仅在函数。fun 的花括号中填入所编写的若干语句。 试题程序: #include <stdio. h> #include <conio. h> float fun (float h ) { } main( ) { float a; clrscr ( ); printf ("Enter a: "); scanf ("%f", &a); printf("The original data is : "); printf("%f/n/n", a) ; printf("The result: %f/n", fun(a) ); }

更多"请编一个函数float fun (double h),函数的功能是对变"的相关试题:

[简答题]请编一个函数float fun (double h),函数的功能是对变量h中的值保留两位小数,并对第三位进行四舍五入(规定h中的值为正数)。
例如:若h值为8.32433,则函数返回8.32:若h值为 8.32533,则函数返回8.33。
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数。fun 的花括号中填入所编写的若干语句。
试题程序:
#include <stdio. h>
#include <conio. h>
float fun (float h )


main( )

float a;
clrscr ( );
printf ("Enter a: ");
scanf ("%f", &a);
printf("The original data is : ");
printf("%f/n/n", a) ;
printf("The result: %f/n", fun(a) );

[简答题]请编一个函数float proc(double h),函数的功能是对变量h中的值保留两位小数,并对第3位进行四舍五入(规定h中的值为正数)。
例如,若h值为7.32596,则函数返回7.33;若h值为7.32496,则函数返回7.32。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
float proc(float h)


void main( )

float f;
system("CLS");
printf("Enter f: ");
scanf("%f", &f);
printf("The original data is: ");
printf("%f/n/n", f);
printf("The result: %f/n", proc(f));

[简答题]请编一个函数fun(char*str),该函数的功能是把字符串中的内容逆置。
例如,字符串中原有的字符串为asdfg,则调用该函数后,串中的内容为gfdsa。
请勿改动主函数rllain和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<string.h>
#include<conio.h>
#include<stdio.h>
#define N 100
void fun(char*str)

char a[N];
FILE*out;
printf("Enter a string:");
gets(a);
printf("The original string is:");
puts(a);
fun(a);


main( )
printf("The string after modified:");
puts(a);
strcpy(a,"Welcome!");
fun(a);
out=fopen("outfile.dat","w");
fprintf(out,"%s",a);
fclose(out);

[简答题]请编一个函数int fun(float s[ ],int n),它的功能是:求高于平均分的人数,并作为函数值返回。数组s中存放n位学生的成绩。数组s的值由主函数从键盘读入,用-1来结束输入。
[多项选择]请编一个函数int fun(int a),它的功能是:判断a是否是素数,若a是素数,返回1;若不是素数,返回0。A的值由主函数从键盘读入。
[简答题]请编一个函数void fun( int tt[M][N], int pp[N], tt指向一个M行N列的二维数组,求出二维数组每列中最大元素,并依次放入pp所指的一维数组中。二维数组中的数已在主函数中给出。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#define M 3
#define N 4
void fun(int tt[M][N],int pp[N])

main( )

int t[M] [N]=68,32,54,12,14,24,88,
58,42, 22, 44, 56;
int p[N],i,j,k;
clrscr( );
printf("The riginal data is:/n");
for(i=0;i<M;i++)

for(j=0;j<N;j++)
printf("%6d",t[i][j]);
printf("/n");

fun(t,p);
printf("/nThe result is:/n");
for(k=0;k<N;k++)
printf("%4d",p[k]);
printf("/n");

[多项选择]编程题 请编一个函数void fun(int tt[M][N], int pp[N]), tt指向一个M行N列的二维数组,求出二维数组每列中最大元素,并依次放入pp所指的一维数组中。二维数组中的数已在主函数中给出。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include #include #define M 3 #define N 4 void fun(int tt[M][N],int pp[N]) { } main( ) { int t[M][N]={{68, 32, 54, 12},{14, 24, 88, 58},{42, 22, 44, 56}}; int p[N],i,j,k; clrscr( ); printf("The riginal data is:/n"); for(i=0;i
[简答题]编程题请编一个函数void fun(int tt[M][N], int pp[N]), tt指向一个M行N列的二维数组,求出二维数组每列中最大元素,并依次放入pp所指的一维数组中。二维数组中的数已在主函数中给出。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:#include #include #define M 3#define N 4void fun(int tt[M][N],int pp[N]){}main( ){ int t[M][N]={{68, 32, 54, 12},{14, 24, 88, 58},{42, 22, 44, 56}}; int p[N],i,j,k; clrscr( ); printf("The riginal data is:/n"); for(i=0;i
[简答题]请编制一个函数arrange(int inBuf[10][9]),其功能是:将一正整数序列K[1],K[2],…,K[9]重新排成一个新的序列。新序列中,比K[1]小的数都在K[1]的左面(后续的再向左存放),比K[1]大的数都在K[1]的右面(后续的再向右存放),从K[1]向右扫描。函数WriteData( )负责将outBuf[]中的数据输出到文件OUT.DAT中。
说明:在程序中已给出了10个序列,每个序列中有9个正整数,并存入数组inBufE10][9]中,分别求出这10个新序列。
例如:序列排序前3,5,8,9,1,2,6,4,7
序列排序后2,1,3,5,8,9,6,4,7
注意:部分源程序已给出。
请勿改动主函数main( )和写函数WriteData( )的内容。
试题程序:
#include<stdio.h>
void writeData( );
int inBuf[10][9]=6,8,9,1,2,5,4,7,3,
3,5,8,9,1,2,6,4,7),
8,2,1,9,3,5,4,6,7),
3,5,1,2,9,8,6,7,4),
4,7,8,9,1,2,5,3,6),
4,7,3,5,1,2,6,8,9),
9,1,3,5,8,6,2,4,7),
2,6,1,9,8,3,5,7,4,
5,3,7,9,1,8,2,6,4,
7,1,3,2,5,8,9,4,6,

void arrangeValue( )


void main( )

int i,j;
arrangeValue( );
for(i=0;i<10;i++)

for(i=0;i<9;i++)

printf(”%d”,inBuf[i][j]);
if(j<=
[简答题]请编写一个函数fun( ),该函数的功能是:返回给定字符串中大写字母字符的个数。
如字符串"Hello World"中,大写字母的个数为2个。
注意:部分源程序已存在文件PROC5.CPP中。
请勿修改主函数和其他函数中的任何内容,仅在函数fun( )的花括号中填写若干语句。
文件PROC5.cpp的内容如下:
//PROC5.cpp
#include<iostream>
#include<string>
using namespace std;
int fun(char *str);
int main( )

char str[ ]="Chinese Computer World";
cout<<fun(str)<<end;
return 0;

int fun(char *str)

//**********

[填空题]函数fun的功能是将一个数字字符串转换为一个整数,请将函数补充完整。
int fun(char *str)
int num=0;
while(*str)
num*=10;
num+=______;
str++;

return num;

[填空题]请补充fun( )函数,该函数的功能是求m的阶乘。不要改动主函数main( )与他函数中的任何内容,仅在fun( )函数的横线上填写所需的若干表达式或语句。
注意:部分源程序如下。
#include<stdio.h>
long fun(int m)

if (1)
return(m*fun (2) );
return (3) ;

main( )

printf("8!=%ld/n",fun(8));

[填空题]请补充函数fun( ),该函数的功能是判断一个数是否为素数。该数是素数时,函数返回字符串:yes!,否则函数返回字符串:no!,并在主函数中输出。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include "conio.h" #include "stdio.h" 【1】 { int i, m; m=1; for(i= 【2】 ;i<n; i++) if ( 【3】 ) { m=0; break; } if(m==1&&n>1) return("yes!"); else return("no!"); } main( ) { int k=0; clrscr( ); printf("Input:"); scanf("%d",&k); printf("%s/n",fun(k)); }

我来回答:

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

订单号:

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