-
以下程序的输出结果是( ) #include iostream.h #include string.h void main() { char *p[10]={abc,aabdfg,dcdbe,abbd,cd}; cout<
-
若有以下程序:include<iostream>using namespace std;class A{private:int a;public:A(int i){a
若有以下程序: include<iostream> using namespace std; class A {private: int a; public: A(int i) {a=i;} void disp() {cout<<a<<“,”;}}; class B {private: int b; public: B(int j {b=j;} void disp() {cout<<b<<
A.10,10,10
B.10,12,14
C.8,10,12
D.8,12,10
-
以下程序的输出结果是()。include <iostream.h>void main(){int a=0,i;for(i=1 ;i<5;i++){ switc
以下程序的输出结果是()。include <iostream.h>void main(){ int a=0,i; for(i=1 ;i<5;i++) { switch(i) { case 0: case 3: a+ =2; case 1: case 2: a+ =3; default: a+ =5; } } cout<<a<<end1; return;}
A.31
B.13
C.10
D.20
-
若有以下程序: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<iostream.h> floa()
A.编译出错
B.9
C.21
D.9.0
-
以下程序段的输出结果是[ ]。 include<iostream.h> void ref(int &i); void main(){int val=1
以下程序段的输出结果是 [ ] 。
include<iostream.h>
void ref(int &i);
void main(){
int val=1;
cout<<“旧值:”<<val<<end1;
ref(val);
cout<<”新值:”<<val<<end1;
}
void ref(int &i){i=10;}
-
以下程序的输出结果是【】。 include<iostream.h> int add(int x,int y) { retum X+y; } dOuble ad
以下程序的输出结果是【 】。
include<iostream.h>
int add(int x,int y)
{
retum X+y;
}
dOuble add(dOUble x,double y)
{
return x+y;
}
void main()
{
int a=4,b=6;
double c=2.6,d=7.4;
cout<<add(a,b)<<",”<<add(C,d)<<endl;
}
-
以下程序段的执行结果为()。include< iostream.h>definePLUS(x,y)x+yvoid main (){int x=1,y=2,
以下程序段的执行结果为()。 include< iostream.h> definePLUS(x,y) x+y void main () {int x=1,y=2,Z=3,sum: sum=PLUS (x+y,Z) * PLUS (y,Z): cout<<"SUM="<<sum; cout<<endl:}
A.SUM=9
B.SUM=12
C.SUM=18
D.SUM=30
-
以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误原因是()。 include<iostream.
以下程序中调用cin函数给变量a输入数值的方法是错误的,其错误原因是()。 include<iostream.h> void main {int * P,* q,a,b; P=&a: eout<<”input a:”; cin>>P:
A.* P表示的是指针变量P的地址
B.P表示的是变量a的地址,而不是变量a的值
C.*P表示的是指针变量P的值
D.*P只能用来说明P是一个指针变量
-
有以下程序include<iostream,h>int i=0;void fun(){{ Static int i=1 Std::cont<<i++<<','; } S
有以下程序 include<iostream,h> int i=0; void fun() { { Static int i=1 Std::cont<<i++<<','; } Std::cout<<i<<','; } int main() { fun();fun(); return 0; } 程序执行后的输出结果是()。
A.1,2,1,2,
B.1,2,2,3,
C.2,0,3,0,
D.1,0,2,0,
-
阅读以下程序,写出程序运行后的输出结果是 ______。include<iostream.h>void main(){char a[]={'
阅读以下程序,写出程序运行后的输出结果是 ______。 include<iostream.h> void main(){ char a[]={'H','e','1','1','o','\0'}; int i,j; i=sizeof(a)/sizeof(char); j=strlen(a) cout<<i<<‘ ’<<j;
A.6 6
B.5 6
C.1 5
D.6 5
-
以下程序的输出结果是 ______。include<iostream.h>void main() {char w[][10]={ "ABC", "DEFGH"
以下程序的输出结果是 ______。 include<iostream.h> void main() { char w[][10]={ "ABC", "DEFGH", "IJKL" , "MNOP" }; int k; for (k=1 ;k<3 ;k++) cout<<w[k]<< " " }
A.ABC FGH KL
B.ABC EFG IJ M
C.EFG JK 0
D.DEFGH IJKL
-
以下程序的输出结果是 。 include <iostream> include <iomanip> using namespace
以下程序的输出结果是 。 include <iostream> include <iomanip> using namespace std; void main() { int i; for (i=1;i>=0;) cout< <i--;>
-
有以下程序:include<iostream.h>void main(){ int x=5,y=2; cout<<!(y==x/2)<<","; cout<<y!=x%
有以下程序: include<iostream.h> void main() { int x=5,y=2; cout<<!(y==x/2)<<","; cout<<y!=x%3)<<","; cout<<(x>0&&y<0)<<","; cout<<(x!=y‖x>=y)<<endl: } 程序执行后的输出结果是()
A.0,0,0,1
B.1,1,1 1
C.0,0, 1,1
D.1,1,0,0
-
若有如下语句 include<iostream.h>void main(){int x=3;do{x=x-2cout<<x;{while (!(- -x);}则上
若有如下语句 include<iostream.h> void main() { int x=3; do{ x=x-2 cout<<x; {while (! (- -x); } 则上面程序段()
A.输出的是1
B.输出的是1和一2
C.输出的是3和0
D.是死循环
-
有以下程序: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<iostream>using namespace std;{public:TestClass(int r1,int r2){R1=r1;R2
有以下程序: include<iostream> using namespace std; { public: TestClass(int r1,int r2) { R1=r1; R2=r2; } void print(); void print() const; private; int R1,R2; }; void TestClass::print() { cout<<R1<<","<<R2<<end1; } void Testclass::print() const cout<<R1<<<<","<<R2<<end1; } int main() { TestClass a(5,4); const TestClass b(20,52); b.print(); return 0; } 执行后的输出结果是()。
A.5,4
B.20,52
C.0,0
D.4,5
-
有以下程序 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;class sample{private:int n;public:sample(
有以下程序: include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n=s1.n+s2.n; return(*this); } void disp() { cout<<"n"<<n<<end1; } }; int main() { sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0; } 程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
-
有以下程序include<iostream>using namespace std;int a;int fun();int main(){extern int a;in
有以下程序 include<iostream> using namespace std; int a; int fun(); int main() { extern int a; int b; a=100; b=fun(); cout<<b<<end1; return 0; } int fun() { extern int a; return(10*A) ; } 其程序运行后的输出结果是
A.100
B.10
C.1000
D.10000
-
若有如下程序:include<iostream>using namespace std;class TestClass{public:void who() {cout
若有如下程序: include<iostream> using namespace std; class TestClass { public: void who() {cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TcstClass1 obj1; p=&obj1; p->who(); return 0; } 则该程序运行后的输出结果是()。
A.TestClass1
B.TestClass
C.0
D.无输出
-
若运行时给变量x输入12,则以下程序的运行结果是include <iostream.h>void main(){ int x,y; cin
若运行时给变量x输入12,则以下程序的运行结果是 include <iostream.h> void main() { int x,y; cin>>x; y=x>12? x+10:x-12; cout<<y; cout<<endl; }
A.0
B.22
C.12
D.10
-
以下程序的执行结果为()。include<iostream.h>Class sample{ int n;public: sample(int i){n=i;}
以下程序的执行结果为()。 include<iostream.h> Class sample { int n; public: sample(int i){n=i; } operator ++() { n++; } void display() {cout<<n<<end1; } }; void main() { sample obj(5); obj++;
A.5
B.6
C.7
D.8
-
有以下程序:include <iostream>using namespace std;int main (){ int n; cin>>n; if (n++<10)c
有以下程序: include <iostream> using namespace std; int main () { int n; cin>>n; if (n++<10) cout<<n<<end1; else cout<<n--<<end1; return 0; } 若执行该程序时从键盘上输入9,则输出结果是()。
A.11
B.10
C.9
D.8