更多"函数Mal('123.45')+Val('233.6')的值是 【7】"的相关试题:
[填空题]函数Mal("123.45")+Val("233.6")的值是 【7】 。
[简答题]请编写函数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");
}
[简答题]请编写函数proc( ),函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。
例如,若二维数组中的值为:
0 1 2 3 4
5 9 7 4 5
4 3 8 3 6
3 5 6 8 7
则函数值为59。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#define M 4
#define N 5
int proc(int a[M][N])
void main( )
int aa[M]EN]=0, 1, 2, 3, 4, 5, 9, 7.4, 5,
4, 3, 8, 3, 6, (3, 5, 6.8, 7;
int i, j, y;
system("CLS");
printf("The original data is: /n");
for(i=0; i<M; i++)
for(j=0; j<N; j++)
printf("%6d", aa[i][j]);
printf("/n");
y=proc(aa);
printf("/nThc sun: %d/n", y);
printf("/n");
[简答题]
请编写函数fun, 函数的功能是:统计一行字符串中单词的个数,作为函数值返 回。一行字符串在主函数中输入, 规定所有单词由小写字母组成,单词之间由若干 个空格隔开, 一行的开始没有空格。
注意:部分源程序在文件PROG1.C中。
请勿改动主函数main和其它函数中的任何内容, 仅在函数fun的花括号中填入你编写的若干语句。
给定源程序:
#include
#include
#define N 80
int fun( char *s)
{
}
main( )
{ char line[N]; int num=0;
printf("Enter a string :/n"); gets(line);
num=fun( line );
printf("The number of word is : %d/n/n",num);
NONO( );
}
[单项选择]以下函数findmin拟实现存数组中查找最小值作为函数值返回,但程序中有错导致不能实现预定功能。
#define MAX 2147483647
int findmin(int x[],int n)
int i,min;
min=MAX;
for(i=0;i<n;i++)
if(min<x[i])min=x[i];
造成错误的原因是( )。
A. 定义语句int i,min;中min未赋初值
B. 赋值语句min=MAN;中,不应给min赋MAX值
C. 语句if(min<X[i])min=X[i];中判断条件设置错误
D. 赋值语句min=MAX;放错了位置
[简答题]编写函数proc( ),函数的功能是:根据以下公式计算s,计算结果作为函数值返回,m通过形参传入。
S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+m)
例如,若n的值为11时,函数的值为1.833333。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
float proc(int m)
void main( )
int m;
float s;
system ("CLS");
printf("/nPlease enter M: ");
scanf("%d", &m);
s=proc(m);
printf("The result is: %f/n", s);
[简答题]编写函数fun( ),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。
S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)
例如:若n的值为11时,函数的值为1.833333。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
float fun(int n)
{
}
main( )
{
int n;
float s;
clrscr( );
printf("/nPlease enter N: ");
scanf("%d",&n);
s=fun(n);
printf("The result is:%f/n " , s);
}
[填空题]下列事件过程的功能是:建立一个名为Data1的随机文件,存放角度值及这些角度的正弦 函数值和余弦函数值,角度为1,2,3,…,90。请在空白处填入适当的内容,将程序补充完整。
Private Type Ang
K As Integer
Sinx As Single
Cosx AS Single
End Type
Dim Ksc As Ang
Private Sub Form _Click( )
Dim Y As Single
Open 【 】
Y=3.14159/180
For I=1 To 90
Ksc.K=I
Ksc.Sinx=Sin(I*Y)
Ksc.Cosx=Cos(I*Y)
【 】
Next I
Clise #2
End Sub
[单项选择]以下函数findmax拟实现在数组中查找最大值并作为函数值返回,但程序中有错导致不能实现预定功能。
#define MIN-2147483647
int findmax(int x[],int n)
int i,max;
for(i=0;i<n;i++)
max=MIN;
if(max<x[i])max=x[i];
return max;
造成错误的原因是( )。
A. 定义语句“int i,max;”中,max未赋初值
B. 赋值语句“max=MIN”;中,不应给max赋MIN值
C. 语句“if(max<x[i]max=x[i])”中,判断条件设置错误
D. 赋值语句“max=MIN;”放错了位置
[单项选择]以下函数findmax拟实现在数组中查找最大值并作为函数值返回,但程序中有错导致不能实现预定功能,造成错误的原因是
#define MIN -2147483647
int findmax (int X[], int n)
int i, max;
for(i=0; i<n; i++)
max=MIN;
if(max<x[i]) max=x[i];
return max;
A. 定义语句int i, max; 中max未赋初值
B. 赋值语句max=MIN;中,不应给max赋MIN值
C. 语句if(max<x[i]) max=x[i];中判断条件设置错误
D. 赋值语句max=MIN;放错了位置
[单项选择]有如下函数过程:
Function Fun(By Val x As Integer,By Val y As Integer)As Integer
Do While Y<>0
reminder=x Mod y
x=y
y=reminder
Loop
Fun=x
End Function
以下调用函数的事件过程,该程序的运行结果是
Private Sub Command7_Click( )
Dim a As Integer,b As Integer
a=100:b=25
x=Fun(a,B)
Print x
End Sub
A. 0
B. 25
C. 50
D. 100
[填空题]有如下函数过程:
Function gys(By Val x As Integer,By Val y As Integer) As Integer
Do While y<>0
preminder=x/y
x=y
y=preminder
Loop
gys=x
End Function
以下是调用该函数的事件过程,该程序的运行结果是______。
Private Sub Command1_Click( )
Dim a As Integer,b As Integer
a=10:b=2
x=gys(a,b)
Print x
End Sub