网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

若有以下程序段: void x(int n); void main() { void x(int n); x(5); } void x(int n){ cout<<n: } 则以下叙述不正确的是 ______。

A.若只在子函数中对函数x进行声明,则只能在主数中正确调用函数x

B.若只在子函数前面对函数x进行声明,则其后的所有函数中都可以正确调用函数x

C.对于以上程序,编译时系统会提示出错信息:提示对x函数重复声明

D.函数x无返回值,所以可用void定义x的函数类型


参考答案

更多 “ 若有以下程序段: void x(int n); void main() { void x(int n); x(5); } void x(int n){ cout<<n: } 则以下叙述不正确的是 ______。A.若只在子函数中对函数x进行声明,则只能在主数中正确调用函数xB.若只在子函数前面对函数x进行声明,则其后的所有函数中都可以正确调用函数xC.对于以上程序,编译时系统会提示出错信息:提示对x函数重复声明D.函数x无返回值,所以可用void定义x的函数类型 ” 相关考题
考题 有以下程序:int sub(int n) { return(n/10+n%10); }void main(){ int x,y; scanf("%d",x); y=sub(sub(sub(x))); printf("%d\n",y);}若运行时输入:4321回车,程序的输出结果是。

考题 阅读下面程序: include void fun(int n) { int x(5); static int y(10); if(n>0) { 阅读下面程序:include<iostream.h>void fun(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<end1;}}void main(){int m(1);fun(m);}则该程序的输出结果是______。

考题 阅读下面程序: include void f(int n) { int x(5); static int y(10); if(n>0) { ++ 阅读下面程序:include<iostream.h>void f(int n){int x(5);static int y(10);if(n>0){++x;++y;cout<<x<<","<<y<<endl;}}void main(){int m(1);f(m),}则该程序的输出结果是【 】

考题 include void main( ) { int n=9; while(n>6) { n--; cout #include<iostream.h> void main( ) { int n=9; while(n>6) { n--; cout < < n;} } 该程序的输出结果是A.987B.876C.8765D.9876

考题 下面程序的执行结果是【】。include void main(){int n=0,x=0;do{n++;if(n%3==2do{n++;if(n%3==2n%5==3n%7==2)x=1;}while(x!=1);cout<<"n=" <<n<<end1;}

考题 以下程序的执行结果是【】。 include include void pnnt(int n) { if (n!=0 以下程序的执行结果是【 】。include<iostream.h>include<iomanip.h>void pnnt(int n){if (n!=0){Print(n-1);for (int i=1;i<=n;i++)cout<<setw(3)<<i;cout<<endl;}}void main(){print(4);}

考题 若有以下调用语句,则不正确的fun函数的首部是______。 main() { …… int a[50],n; fun(n,a[9]); …… }A.void fun(int m, int x[])B.void fun(kit s, kit h[41])C.void fun(kit p, kit *s)D.void fun(int n, int a)

考题 下面程序的运行结果为_____。 include void fun(int x=0,int y=0) { cout 下面程序的运行结果为_____。include<iostream.h>void fun(int x=0,int y=0){cout < < x < < y;}void main( ){fun(5) ;}

考题 以下程序的执行结果是______。 include class A{ int a: public: void seta(int x) { 以下程序的执行结果是______。include<iostream.h>class A{int a:public:void seta(int x) {a=x;}void showa() {cout<<a<<end1;}};class B{int b;public:void setb(int x) {b=x;}void showb(){cout<<b<<end1;}};

考题 写出下列程序的运行结果【】。 include void func(double x, int part1, double 写出下列程序的运行结果【 】。include<iostream. h>void func(double x, int part1, double part2){part1=int(x)+500:part2=(x+500-part1)*100;}void main( ){int n;double x, f;x=1001. 0103;func (x, n, f):cout<<"Part 1="<<n<<" , part2="<<f<<end1}

考题 给出以下程序的执行结果【】。 include using namespace std; int n=1; void Fun(); int 给出以下程序的执行结果【 】。include <iostream>using namespace std;int n=1;void Fun();int main (){n++;Fun ( );if (n>0){int n=5;cout<<"Block: n="<<n<< ", ";}cout<< "Main: n="<<end1;return 0;}void Fun ( ){int n=10;cout<<"Fun: n="<<n<<",";}

考题 若有以下调用语句,则不正确的fun函数的首部是( )。 main() { … int a[50],n; … fun(n,a[9]); … }A.void fun(int m,int x[])B.void fun(int s,int h[41])C.voidfun(int p,int*s)D.void fun(int n,iht a)

考题 有以下程序:includedefine N 8void fun(int*x,int i){*x=*(x+i)+1;}main(){int a[N]= 有以下程序: #include<stdio.h> #define N 8 void fun(int*x,int i) {*x=*(x+i)+1;} main() {int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=0;i<N/2;i++) {printf("%d",a[i]);} printf("\n"); } 程序运行后的输出结果是( )。A.1 3 1 3B.3 2 3 4C.4 2 3 4D.1 2 3 4

考题 以下程序的执行结果是 ______。 include int max(int x,int y) { ret 以下程序的执行结果是 ______。include<iostream.h>int max(int x,int y){return(x>y? x:y);}void main(){int n=2,m=10;max(n,m)--;cout<<"n="<<n<<",m="<<m<<endl;}

考题 若有以下程序:includeusing namespace std;class A{private:int a; public:void seta 若有以下程序: #include<iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb(int x) { b=x; } void showb() { cout<<b<<",”; } }; class C:pUblic A,private B { private: int c; public: void setc(int x,int y,int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; } }; int main() { Cc; c.setc(1,2,3); c.showc(); retrun 0; } 程序执行后的输出结果是A.1,2,3B.1,1,1C.2,2,2D.3,3,3

考题 下列程序的输出结果为【 】。ineludeint max(int x, int y){return (x 下列程序的输出结果为【 】。inelude<iostream. h>int max(int x, int y){return (x>y? x: y); }void main() {int n=3, m=12;max(m, n)++cout<<"m="<<m<<", n= "<<n<<end1;}

考题 若有以下程序:includeusing namespace std;class A{private:inta;public:voidseta(in 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb (int x) { b=x; } void showb() { cout<<b<<","; } }; class C :public A,private B { private: int c; public: void setc(int x, inc y, int z) { c=z; seta (x); setb (y); } void showc() { showa (); showb (); cout<<c<<end1; } }; int main () { C c; c. setc(1,2,3); c.showc(); return 0; } 程序执行后的输出结果是A.1,2,3B.1,1,1C.2,2,2D.3,3,3

考题 以下程序的输出的结果是()。include int x=3;void main(){void incre();int i;for ( 以下程序的输出的结果是( )。#include <iostream.h>int x=3;void main(){ void incre(); int i; for (i=1;i<x;i++) incre();}Void incre(){ static int x=1; x*=x+1; cout<<x<<"";}A.3 3B.2 2C.2 6D.2 5

考题 若有以下程序:include using namespace std;class A{private:int a;public:void seta 若有以下程序:#include <iostream>using namespace std;class A{private: int a;public: void seta(int x) { a=x; } void showa() { cout<<a<<","; }};class B{private: int b;public: void setb(int x) { b=x; } void showb() { cout<<b<<","; }};class C: public A, private B{private: int c;public: void setc(int x, int y, int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; }};int main(){ C c; c.setc(1,2,3); c.showc(); return 0;}程序执行后的输出结果是( )。A.1,2,3B.1,1,1C.2,2,2D.3,3,3

考题 以下程序的输出的结果是()。includeint x=3:void main(){void fun();int i;for(i=1; 以下程序的输出的结果是( )。 #include<iostream.h> int x=3: void main() { void fun(); int i; for(i=1;i<x;i++) fun(); } void fun() { static int x=1; x*=x+1; cout<<x<<" "; }A.3,3B.2,2C.2,6D.2,5

考题 在下面程序运行后,输出结果为 ______。includevoid count(int x[],int n,int y 在下面程序运行后,输出结果为 ______。 #include<iostream.h> void count(int x[],int n,int y){ int k; y=0; for(k=0:k<n;k++) if(x[k]<0) y++; } void main(){ int b[]={2,1,-8,-3,7,2,4,6,0,-13}; int x; count(b,10,x); cout<<“x”<<x<<end1; }A.x=3B.x=5C.出错D.x=0

考题 有以下程序: #include #define N 4 void fun(int a[ ][N],int b[ ]) { int i; for(i=0;i main( ) { int i,j,x=0; for(i=0;iA.x=4B.x=6C.x=8D.x=12

考题 若有以下调用语句,则不正确的 fun 函数的首部是( )。 void main() { int a[50],n; fun(n,a[9]); }A.void fun(int m,int x[])B.void fun(int s,int h[])C.void fun(intp,int * s)D.void fun(int n,int a)

考题 若有以下调用语句,则不正确的fun函数的首部是( )。 main() { int a[50],n; fun(n,a[9]); ┆ }A.void fun(int m,int x[])B.void fun(int s,int h[41])C.void fun(int p,int *s)D.void fun(int n,int a)

考题 执行下列程序段,结果是 #include(iostream.h> void main() { int x=40; char y=‘C’;int n; n=(x0xff)(y>‘B’); cout<<n;}A.0B.1C.2D.3

考题 下列程序段的执行结果为()。includeusing namespace std;class example{int n;public: 下列程序段的执行结果为( )。 #include<iostream> using namespace std; class example{ int n; public: example(int i){n=i;} void add(){s+=n;} static int s; void pr(){ cout<<s<<endl; } }; int example::s=0; int fuc(char *x); int main(){ example x(2),y(3),z(4); x. add(); y. add(); z.pr(); return 0; }A.2B.3C.5D.6

考题 下列程序的输出结果是______。 include using namespace std; class base { public: in 下列程序的输出结果是______。include<iostream>using namespace std;class base{public:int n;base(int x){n=x;}virtual void set(int m){n=m;cout<<n<<'';}};class deriveA:public base{public:deriveA(int x):base(x){}void set(int m){n+=m;cout<<n<<'';}};class deriveB:public base{public:deriveB(int x):base(x){}void set(int m){n+=m;cout<<n<<'';}};int main( ){deriveA d1(1);deriveB.d2(3);base*pbase;pbase=d1;pbase->set(1);pbase=d2;pbase->set(2);return 0;}