-
若有以下程序 #include void f(int n) main() { void f(int n); f(5); } void f(int n); { printf("%d\n",n); } 则以下叙述不正确的是()
A . 若只在主函数中对函数f进行说明,则只能在主函数中正确调用函数f
B . 若在主函数前对函数f进行说明,则在主函数和其它函数中都可以正确调用函数f
C . 对于以上程序,编译时系统会出提示出错信息:提示对f函数重复说明
D . 函数f无返回值,所以可用void将其类型定义为无值型
-
有以下程序#include<stdio.h>int f(int x);main(){int n=1,m;m=f(f(f(n)));printf(”%d\n”,m);}int f(int x){return x*2;}程序运行后的输出结果是
-
有以下程序#include int main(){ int findmax(int,int,int),m;┋m=findmax(a,b,c);┋}int findmax(int x,int y,int z){ … }则以下叙述正确的是( )。
-
以下程序的运行结果为_____。 #include #define f(x) x*x void main() { int a = 6, b = 2, c; c = f(a)/f(b); printf('%d', c); }
-
以下程序的输出结果是( )。#include \stdio.h\int f(int x){ return x*2; }main( ){ int n=1,m;m=f(f(f(n)));printf(\%d\\n\,m);}
-
有以下程序 #include #define f(x) x*x*x main() { int a=3,s,t; s=f(a+1);t=f((a+1)); printf(“%d,%d’,s,t); } 程序运行后的输出结果是
-
有下列程序: include <stdio.h> int f(int x) { int y; if(x=0‖x==1)return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3);printf("%d\n",z); 程序的运行结果是()。
A.0
B.9
C.6
D.8
-
若有以下程序include <stdio.h>void f(int n);main(){ void f(int n); f(5);}void f(int n){ printf("%d\n",n); }则以下叙述中不正确的是
A.若只在主函数中对函数f进行说明,则只能在主函数中正确调用函数f
B.若在主函数前对函数f进行说明,则在主函数和其他函数中都可以正确调用函数f
C.对于以上程序,编译时系统会提示出错信息:对f函数重复说明
D.函数f无返回值,所以,可用void将其类型定义为无返回值型
-
若有以下程序:include <iostream>using namespace std;int f(){static int i = O;ints= 1;s+=i;
若有以下程序:include <iostream>using namespace std;int f(){ static int i = O; ints= 1; s+=i; i++; return s;}int main(){ int i, a =0; for(i=0;i<5;i++) a+=f(); cout<<a<<end1; return 0;}程序运行后,输出的结果是()。
A.20
B.24
C.25
D.15
-
有以下程序include<stdio.h>int f(int x);main(){int n=1,m;m=f(f(f(n)));printf(”%d\n”,m);}int f(int x){return x*2;}程序运行后的输出结果是()。
A.1
B.2
C.4
D.8
-
有以下程序:include<stdio.h>define F(X,Y)(X)*(Y)main(){int a=3,b=4; printf("%d\n",F(a++,b
有以下程序: include<stdio.h> define F(X,Y) (X)*(Y) main() { int a=3,b=4; printf("%d\n",F(a++,b++)); } 程序运行后的输出结果是()。
A.12
B.15
C.16
D.20
-
有以下程序: include<stdio.h> int f(int t[],int n); main() {int a[4]={1,2,3,4
有以下程序: include<stdio.h> int f(int t[],int n); main() {int a[4]={1,2,3,4},s; s=f(a,4);printf("%d\n",s); int f(int t[],int n) {if(n>0)return t[n-1]+f(t,n-1); else return 0; } 程序运行后的输出结果是()。
A.4
B.10
C.14
D.6
-
以下程序的运行结果是 include <stdio.h> int main() { int a = 12, b = 3; float x = 18.5, y = 4.5; printf("%f\n", (float)(a * b) / 2); printf("%d\n", (int)x %(int)y); return 0; }
A.18.000000 2
B.18 2
C.18 2.000000
D.18.000000 2.000000
-
有以下程序:include <iostream>using namespace std;int main (){int x=15;while (x>10&&am
有以下程序: include <iostream> using namespace std; int main () { int x=15; while (x>10&&x<50) { x++; if (x/3) { x++; break; } } cout<<x<<endl; return 0; } 执行后的输出结果是
A.15
B.16
C.17
D.18
-
有以下程序: include<stdio.h> int f(int x); main() { int a,b=0; for(a=0;a<
有以下程序: include<stdio.h> int f(int x); main() { int a,b=0; for(a=0;a<3;a++) { b=b+f(a);putchar(A+b);} } int f(int x) { return x * x1; } 程序运行后的输出结果是()。
A.ABE
B.BDI
C.BCF
D.BCD
-
有以下程序 include<iostream.h> floatfun(int x,int y) {return(x+y);}void main() {int a=2,b
有以下程序 include<iostream.h> floatfun(int x,int y) {return(x+y);} void main() {int a=2,b=5,c=8; tout<<fun((int)fun(a+c,b),a-C);} 程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9
-
若有以下程序:include <iostream>using namespace std;void sub(int x,int y, int *z){ *Z = y+
若有以下程序: include <iostream> using namespace std; void sub(int x,int y, int *z) { *Z = y+x; } int main() { int a,b,c; sub(8,4,&a); sub(6,a,&b); sub(a,b,&c); cout<<a<<","<<b<<","<<c<<endl; return 0; 程序运行后的输出结果是()。
A.12,18,30
B.-12,6,8
C.6,8,10
D.12,-18,16
-
有以下程序include<iostream.h>float fun(int x,int y){return(x+y);}void main(){int a=2,b=5,
有以下程序 include<iostream.h> float fun(int x,int y) {return(x+y);} void main() {int a=2,b=5,c=8; cout<<fun((int)fun(a+c,b),a-c);} 程序运行后的输出结果是()。
A.编译出错
B.9
C.21
D.9
-
有以下程序: include include struct A {int a;char b[10];double C;); struct A f(struct A t
有以下程序: include include struct A {int a;char b[10];double C;); struct A f(struct A t): main() {struct A a={1001,"ZhangDa",l098.0}; a=f(a);printf("%d,%S,%6.1f\n",a.a,a.b,a.c); } struct A f(struct A t) {t.a= 1002;strcpy(t.b,"ChangRon9");t.c=1202.0;return t;} 程序运行后的输出结果是()。
A.1001,ZhangDa,1098.0
B.1002,ZhangDa,1202.0
C.1001,ChangRong,1098.0
D.1002,ChangRong,1202.0
-
有以下程序: include int f(int x); main() { int a,b=0; for(a=0;a<3;a++) { b=b+f(a);putchar(A+b);} } int f(int x) { return x * x1; } 程序运行后的输出结果是()。
A.ABE
B.BDI
C.BCF
D.BCD
-
下面的程序使用了函数指针,其运行结果是______。include<stdio.h>include<math.h>int f1(int a){return a*a;}int f2(int a){return a*a*a;}void main(){int x=3,y1,y2,y3,y4;f=f1;y1=(*f)(x);y2=f1(x);f=f2;y3=f(x);y4=f2(x);pri
A.y1=27,y2=9,y3=9,y4=27
B.y1=9,y2=9,y3=27,y4=27
C.y1=9,y2=27,y3=9,y4=27
D.y1=27,y2=27,y3=9,y4=9
-
有以下程序: include <stdio.h> int f(int n); main() (int a=3,s; s=f(a);s=s+f(a);printf("%d",s); int f(int n) (static int a=1; n+=a++: return n: 程序运行以后输出的结果是()。
A.7
B.8
C.9
D.10
-
下列程序输出的结果是()。include void f(int * x ){ *x = 10 ;
下列程序输出的结果是()。include void f(int * x ){ *x = 10 ; }void main(){ int a,*p=&a; f(p); printf("%d",++(*p));}提示:指针x指与指针p指向同一个变量,10赋给指针x所指的地址上的内容,++(*p)是指指针p所指地址上内容++。
A 输出的值是随机值
B 因输出语句错误而不能执行者
C 输出值为10
D 输出值为11
-
有以下程序段,在空白处填入(),可以使程序正确运行。 include <stdio.h> int (int x,int y)
有以下程序段,在空白处填入(),可以使程序正确运行。 include <stdio.h> int (int x,int y) {if(x>y)return &x; else return &y; } main() {int a=3,b=5,*p; p=f(a,b); printf("%d",*p); }
A、f
B、*f
C、(*f)
D、其余选项都不对