函数原型
下列程序输入3个整数(3个数之和不会超过整型数的最大值),计算并输出它们的平均值。下划线填入那个(些)行既不会导致编译错误也不会导致编译警告。
#include <stdio.h>
____________________________________________________________
A) 函数原型直接省略
B) getAverage(int a,int b,int c);
C) double getAverage(int a,int b,int c);
D) double getAverage(int a,b,c);
E) double getAverage(int x,int y,int z);
F) double getAverage(int a,int b,int c) {}
G) double getAverage(int a,int b);
H) double getAverage(int,int,int);
I) double getAverage(double a,double b,double c);
J) double getAverage(int a;int b;int c);
K) double getAverage(a,b,c);
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
printf("%.3f\n",getAverage(a,b,c));
return 0;
}
double getAverage(int a,int b,int c) {return a/3.0+b/3.0+c/3.0;}
#include<stdio.h>
int main(){
printf("CEH");
}
函数定义
下列程序输入3个整数(3个数之和不会超过整型数的最大值),计算并输出它们的平均值。下划线填入那个(些)行既不会导致编译错误也不会导致编译警告,并且可以得到正确的结果。
#include <stdio.h>
double getAverage(int a,int b,int c);
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
printf("%.3f\n",getAverage(a,b,c));
return 0;
}
____________________________________________________________________________________
A) double getAverage(int a,int b,int c) {return (double)(a+b+c)/3.0};
B) double getAverage(int a,int b,int c) {return a/3.0+b/3.0+c/3.0;}
C) double getAverage(int α,int β,int γ) {return (double)(α+β+γ)/3.0;}
D) double getAverage(int a,int b,int c) {return a/3+b/3+c/3;}
E) double getAverage(int a,int b,int c) {return ((double)a+b+c)/3.0;}
F) double getAverage(int a,int b,int c) {return (double)(a+b+c)/3.0;}
G) double getAverage(int a,int b,int c) {return (a+b+c)/3.0;}
H) double getAverage(int a,int b,int c) {return (a+b+c)/3;}
I) double getAverage(int a,int b,int c) {return (a+b+c/3.0);}
J) double getAverage(int a,int b,int c) {return double(a+b+c)/3;}
K) double getAverage(int a,int b,int c) {return (double)(a+b+c)/(double)3;}
L) double getAverage(int x,int y,int z) {return (double)(x+y+z)/3.0;}
M) 函数定义直接省略
N) getAverage(int a,int b,int c) {return (double)(a+b+c)/3.0;}
O) int getAverage(int a,int b,int c) {return (double)(a+b+c)/3.0;}
P) double getAverage(int a,b,c) {return (double)(a+b+c)/3.0;}
Q) double getAverage(int a;int b;int c) {return (double)(a+b+c)/3.0;}
R) double getAverage(int x1,int x2,int x3) {return (double)(x1+x2+x3)/3.0;}
S) double getAverage(int a,int b,int c) {int x=a+b+c;return x/3.0;}
T) double getAverage(int a,int b,int c) {double x=a+b+c;return x/3;}
U) double getAverage(int a,int b) {return (double)(a+b)/2.0;}
V) double getAverage(double a,double b,double c) {return (a+b+c)/3.0;}
#include<stdio.h>
int main(){
printf("BEFGKLRST");
}
函数调用
下列程序输入3个整数(3个数之和不会超过整型数的最大值),计算并输出它们的平均值。下划线填入那个(些)行既不会导致编译错误也不会导致编译警告。
#include <stdio.h>
double getAverage(int a,int b,int c);
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
__________________________________________________________
A) printf("%.3f\n",getAverage(x,y,z));
B) printf("%.3f\n",getAverage(a,b,c));
C) printf("%.3f\n",getAverage(int a,b,c));
D) printf("%.3f\n",getAverage(a+1,b+b,c*c));
E) printf("%.3f\n",getAverage(int a,int b,int c));
F) printf("%.3f\n",getAverage(+123,'A',0xa3));
G) printf("%.3f\n",getAverage(1L,3.5,7.f));
H) printf("%.3f\n",getAverage(&a,&b,&c));
I) printf("%.3f\n",getAverage(a;b;c));
J) printf("%.3f\n",getAverage(a,b));
return 0;
}
double getAverage(int a,int b,int c) {return a/3.0+b/3.0+c/3.0;}
#include<stdio.h>
int main(){
printf("BDF");
}
计算3个整数的平均值
输入3个非常大的整数(三者之和会大于整数的最大值),计算它们的平均值,假定IDE的long类型的长度>int类型的长度。下划线填入那个(些)行程序可以获得正确的结果。
#include <stdio.h>
#include <limits.h>
double getAverage(int a,int b,int c);
int main() {
printf("%.3f\n",getAverage(INT_MAX,INT_MAX,INT_MAX));
return 0;
}
_____________________________________________________________________________
A) double getAverage(int a,int b,int c) {return (double)(a+b+c)/3.0;}
B) double getAverage(int a,int b,int c) {return a/3+b/3+c/3;}
C) double getAverage(int a,int b,int c) {return a/3.0+b/3.0+c/3.0;}
D) double getAverage(int a,int b,int c) {return ((double)a+b+c)/3.0;}
E) double getAverage(int a,int b,int c) {double x=a+b+c;return x/3;}
F) double getAverage(int a,int b,int c) {long int x=(long)a+b+c;return x/3.0;}
G) double getAverage(int a,int b,int c) {return (a+b+c)/3.0;}
H) double getAverage(int a,int b,int c) {int x=a+b+c;return x/3.0;}
#include<stdio.h>
int main() {
printf("CDF");
}
标签:return,函数,int,double,getAverage,3.0,printf
From: https://www.cnblogs.com/szz123/p/18522547