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

[简答题]请编写函数fun,函数的功能是:将3行4列矩阵x乘以4行3列矩阵y,结果放在 3行3列矩阵xy中。矩阵相乘的基本方法是:矩阵xy中行列下标分别为i、j的元素的值,是矩阵x中第i行上4个元素与矩阵y中第j列上4个元素对应相乘的和。 注意:部分源程序在文件PROG1.C中。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。 #include <conio.h> #include <stdio.h> void fun(int a[3][4],int b[4][3],int ab[3][3]) { } main( ) {int x[3][4]={{1,0,1,1},{2,1,0,1},{1,2,0,3}}; int y[4][3]={{1,1,1},{0,0,0},{2,1,1},{1,1,3}}; int xy[3][3]={0},i,j; clrscr( ); fun(x,y,xy); printf("a x b=ab:(3,3):"); for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d",xy[i][j]); printf("/n"): } NONO( );/*本函数与考生答题无关,考生不得改动,否则后果自负。*/ }

更多"请编写函数fun,函数的功能是:将3行4列矩阵x乘以4行3列矩阵y,结"的相关试题:

[简答题]请编写函数fun( ),该函数的功能是:计算n门课程的平均分,计算结果作为函数值返回。 例如x有5门课程的成绩是90.5,72,80,61.5,55,则函数的值为71.80。 注意:部分源程序给出如下. 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> float fun (float *a, int n) { } main ( ) { float score[30]=(90.5,72,80,61.5,55}, aver; aver=fun(score, 5); printf("/nAverage score is: %5.2f /n",aver); }
[简答题]请编写函数fun( ),该函数的功能是:将M行N列的二维数组中的字符数据,按列的顺序依次放到一个字符串中。
例如,若二维数组中的数据为:
W WWW
S S S S
H H H H
则字符串中的内容应是WSHWSHWSHWSH。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
#define M 3
#define N 4
void fun(char (*s)[N],char *b)


main( )

char a[100],w[M][N]= ’W’, ’W’, ’W’, ’W’,
’S’, ’S’, ’S’, ’S’,’H’, ’H’, ’H’, ’H’;
int i,j;
printf("The matrix:/n");
for(i=0;i<M;i++)
for(j=0;j<N;j++)
printf("%3c",w[i][j]);
printf("/n");

fun(w,a);
printf("The A string:In");
puts(a);
printf("/n/n");

[简答题]请编写函数fun( ),该函数的功能是:将两个两位数的正整数a,b合并形成一个整数放在c中。合并的方式是:将a数的十位和个位数依次放在c数的十位和千位上,b数的十位和个位数依次放在c数的百位和个位上。
例如,当a=45时,b=12,调用到该函数后,c=5142。
注意:部分源程序给出如下.
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio.h>
#include<conio.h>
void fun(int a ,int b, long *c)


main ( )

int a,b;
long c;
clrscr( );
printf("Input a ,b:");
scanf(,%d%d",&a,&b);
fun(a,b,&c);
printf("The result is :%ld/n",c);

[简答题]请编写函数fun( ),该函数的功能是:实现B=A+A’,即把矩阵A加上A的转置,存放在矩阵B中。计算结果在main( )函数中输出。 例如,输入下面矩阵: 1 2 3 4 5 6 7 8 9 其转置矩阵为: 1 4 7 2 5 8 3 6 9 则程序输出: 2 6 10 6 10 14 10 14 18 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #include<conio.h> void fun (int a[3][3], int b[3][3]) { } main ( ) { int a[3][3]={{1,2,3}, {4,5,6},{7,8,9}},t[3] [3]; int i, j; clrscr ( ); fun (a,t); for(i=0; i<3; i++) { for (j=0; j<3; j++) printf ("%7d",t [i] [j] ); printf ("/n"); } }
[简答题]请编写函数fun( ),该函数的功能是:移动字符串中的内容,移动的规则是把第1到第m个字符,平移到字符串的最后,把第m+1到最后的字符移到字符串的前部。
例如,字符串中原有的内容为ABCDEFGHIJK,m的值为 3,移动后,字符串中的内容应该是DEFGHIJKABC。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio. h>
#include <string.h>
#define N 80
void fun (char *w, int m)

main ( )

char a[N]= "ABCDEFGHIJK";
int m;
printf ("The origina string : /n");
puts (a);
printf("/n/nEnter m: ");
scanf ("%d", &m);
fun (a, m);
printf (" /nThe string after moving : /n");
puts (a);
printf ("/n/n");

[简答题]请编写函数fun( ),该函数的功能是:移动一维数组中的内容,若数组中有n个整数,要求把下标从p到n-1(p≤n-1)的数组元素平移到数组的前面。
例如,一维数组中的原始内容为1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,p的值为6。移动后,一维数组中的内容应为7,8,9,10,11,12,13,14,15,1,2,3,4,5,6。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
#define N 80
void fun(int *w,int p,int n)

main( )

int a[N]=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15;
int i,p,n=15;
printf("The original data:/n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("/n/nEnter p:");
scanf("%d",&p);
fun(a,p,n);
printf("/nThe data after moving:/n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("/n/n");

[简答题]请编写函数fun( ),该函数的功能是:移动一维数组中的内容,若数组中有n个整数,要求把下标从0到p(p≤n-1)的数组元素平移到数组的最后。
例如,一维数组中的原始内容为1,2,3,4,5,6,7, 8,9,10,11,12,13,14,15,p的值为3。移动后,一维数组中的内容应为5,6,7,8,9,10,11,12,13,14,15, 1, 2, 3, 4。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio.h>
#define N 80
void fun(int *w, int p, int n)


main ( )

int a[N]=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15;
int i, p, n=15;
printf("The original data:/n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("/n/nEnter p: ");
scanf("%d",&p);
fun(a,p,n);
printf("/nThe data after moving:/n");
for(i=0;i<n;i++)
printf("%3d",a[i]);
printf("/n/n");

[简答题]请编写函数fun( ),函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。
例如:若二维数组中的值为
1 3 5 7 9
2 9 9 9 4
6 9 9 9 8
1 3 5 7 0
则函数值为61。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<stdio.h>
#define M 4
#define N 5
int fun( int a [M][N])

main( )

int aa[M][N]=1,3,5,7,9,2,9,9,9,4,
6,9,9,9,8,1,3,5,7,0;
int i, j, y;
clrscr( );
printf ("The original data is :/n ");
for(i=0; i<N;i++)
for (j=0; j<N;j++)
printf("%6d ",aa[i][j]);
printf("/n ");

y=fun(aa);
printf("/nThe sun:%d/n ",y);
printf("/n");

[简答题]请编写函数fun( ),该函数的功能是:将M行N列的二维数组中的数据,按行的顺序依次放到一维数组中,一维数组中数据的个数存放在形参n所指的存储单元中。
例如,若二维数组中的数据为:
33 33 33 33
44 44 44 44
55 55 55 55
则一维数组中的内容应该是33 33 33 33 44 44 44 AA, 55 55 55 55
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio. h>
void fun (int (*s)[10], int *b, int *n,
int mm, int nn)



main ( )

int w[10] [10]=33,33,33,33,44,44,
44,44,55,55,55,55, i, j;
int a[100]=0,n=0 ;
printf ("The matrix: /n" );
for (i=0; i<3; i++)
for (j+0; j<4; j++)
printf ("%3d",w[i] [j] );
printf ("/n");

fun (w,a, &n, 3, 4);
printf ("The A array: In");
for(i=0; i<n; i++)
printf ("%3d", a [i] );
printf ("/n/n");

[简答题]请编写函数fun( ),该函数的功能是:删去一维数组中所有相同的数,使之只剩一个。数组中的数已按由小到大的顺序排列,函数返回删除后数组中数据的个数。 例如,若一维数组中的数据是: 2 2 2 3 4 4 5 6 6 6 6 7 7 8 9 9 10 10 10 删除后,数组中的内容应该是: 2 3 4 5 6 7 8 9 10。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio. h> #define N 80 int fun(int a[], int n) { } main ( ) { int a[N]={ 2,2,2,3,4,4,5,6,6,6,6,7,7, 8,9,9,10,10,10,10}, i, n=20; printf ("The original data : /n"); for(i=0; i<n; i++) printf ("%3d", a [i] ); n=fun (a, n); printf("/n/nThe data after deleted : /n"); for(i=0; i<n; i++) printf ("%3d", a [i] ); printf ("/n/n"); }
[简答题]下列程序定义了NXN的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是求出数组周边元素的平方和并作为函数值返回给主函数中的s。例如:若a数组中的值为 a=0 1 2 7 9 1 11 21 5 5 2 21 6 11 1 9 7 9 10 2 5 4 1 4 1 则返回主程序后s的值应为310。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #include<conio.h> #include<stdlib.h> #define N 5 int fun (int w[][N]) { } main( ) { int a[N][N]={0,1,2,7,9,1,11,21,5,5,2, 21,6,11,1,9,7,9,10,2,5,4,1,4,1}; int i,j; int s; clrscr( ); printf("*****The array***+*/n"); for (i=0;i<N;i++) { for(j=0;j<N;i++) {printf("%4d",a[i][j]);} printf("/n"); } s=fun(a); printf("*****THE RESULT*****/n"); printf("The sum is:%d/n",s); }
[多项选择]编程题 下列程序定义了N×N的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是:求出数组周边元素的平方和并作为函数值返回给主函数中的s。例如:若a 数组中的值为 a=0 1 2 7 9 1 11 21 5 5 2 21 6 11 1 9 7 9 10 2 5 4 1 4 1 则返回主程序后s的值应为310。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include #include #include #define N 5 int fun (int w[][N]) { } main( ) { int a[N][N]={0,1,2,7,9,1,11,21,5,5,2,21,6,11,1,9,7,9,10,2,5,4,1,4,1}; int i, j; int s; clrscr( ); printf("*****The array*****/n "); for (i=0; i
[简答题]下列程序定义了N×N的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是:求出数组周边元素的平均值并作为函数值返回给主函数中的s。例如:若a数组中的值为 a= 0 1 2 7 9 1 9 7 4 5 2 3 8 3 1 4 5 6 8 2 5 9 1 4 1 则返回土程序后s的值应为3.375。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的仟何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio.h> #include<conio.h> #include<stdlib.h> #define N 5 double fun (int w[] [N]) { } main( ) { int a[N] [N]={0,1,2,7,9,1,9,7,4,5,2, 3,8,3,1,4,5,6,8,2,5,9,1,4,1}; int i, j; double s; clrscr( ); printf("*****The array*****/n "); for (i=0; i<N; i++) { for (j=0;j<N;i++) {printf("%4d ",a[i] [j]);} printf("/n "); } s=fun(a); printf("*****THE RESULT*****/n "); printf("The sum is : %lf/n ",s); }
[简答题]请编写一个函数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( ),该函数的功能是:返回给定字符串中大写字母字符的个数。
如字符串"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)

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

我来回答:

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

订单号:

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