下列程序的输出结果是()。 a=1; switch a case 3|4 disp('perfect') case {1,2} disp('ok') otherwise disp('no') endA.okB.perfectC.noD.2
下列程序的输出结果是()。 a=1; switch a case 3|4 disp('perfect') case {1,2} disp('ok') otherwise disp('no') end
A.ok
B.perfect
C.no
D.2
参考答案和解析
c
相关考题:
以下程序:main(){charc;inti;for(i=65;i68;i++){c=i+32;switch(c){case‘a’:printf(“%c,“,c);break;case‘b’:case‘e’:printf(“ok,“);default:printf(“end“);}}}的输出结果为() A、a,ok,endB、a,ok,endendC、a,ok,end,endD、a,ok,ok
下列程序中的重载函数disp( )发生错误,错误原因是【 】。 includeclass Sample {priva 下列程序中的重载函数disp( )发生错误,错误原因是【 】。include<iostream, h>class Sample{private:int m;static int sr;public:Sample(int a) {m=a; st+=a; }static void disp(){cout<<m<<end1; }static void disp(Sample input){cout<<input. m<<end1;}};int Sample: : st=2;void main(){Sample Eirst(2), Second(4)Sample: :disp( );Sample: :disp (Second);}
下列程序的输出结果是______。 main() { int i=3; switch(i) { case 1: case 2:printf("%d",i); case 3: case 4:break; default:printf("OK"); } }A.0B.3C.OKD.没有任何输出
下程序的输出结果是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;}A.31B.13C.10D.20
下列程序的输出结果是()。includemain(){int a=0,i; for(i=1;i 下列程序的输出结果是( )。 #include<stdio.h> main() { int a=0,i; for(i=1;i<5;i++) { switch(i) { case 0: case 3:a+=1; case 1: case 2:a+=2; default:a+=3; } printf("%d",A) ; }A.19B.18C.6D.8
下列程序的输出结果是______。 main() { int i=3; switch(i) { case1: case2:printf("%d",i); case3: case4:break; default: printf ("OK"); } }A.0B.3C.OKD.没有任何输出
有如下程序:include using namespace std;class sample{private:int x,y;public: sam 有如下程序: #include <iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp () { cout<<"disp1"<<end1; } void disp() const { cout<<"disp2"<<end1; };int main () { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是A.disp1B.disp2C.disp1 disp2D.程序编译时出错
以下程序的输出结果是 include void main() { inta=0,i; for(i=1 ;i 以下程序的输出结果是 #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.31B.13C.10D.20
若有以下程序 include using namespace std; class A {private:int a; public: A(in 若有以下程序 #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<<","; } }; class C: public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp() { A::disp(); B::disp(); cout<<c<<end1; } }; int main() { C obj(10); obj.disp(); return 0; } 程序执行后的输出结果是A.10,10,10B.10,12,14C.8,10,12D.8,12,10
如下程序的输出结果是______。 include main() { int x=1,a=3,b=4; switch(x) { case 0 如下程序的输出结果是______。 #include<stdio.h> main() { int x=1,a=3,b=4; switch(x) { case 0:a--; case 1:b--; case 2:a--;b--; } printf("a=%d,b=%d\n",a,b); }A.a=2,b=2B.a=3,b=3C.a=1,b=2D.a=3,b=2
以下程序的执行结果是【】。includeincludeclass Sample{ public: int x,y; 以下程序的执行结果是【 】。include<iostream.h>include<stdlib.h>class Sample{public:int x,y;Sample(){x=y=0;}Sample(int a,int b) {x=a;y=b; }void disp(){cout<<"x="<<x<<",y="<<y<<end1;}};void main() {Sample s1(2,3);s1.disp();}
下列程序的运行结果是【】。 include class Sample {int x,y;public:Sample() {x=y=0 下列程序的运行结果是【 】。include <iostream. h>class Sample {int x,y;public:Sample() {x=y=0; }Sample(int a, int b) {x=a;y=b;}void disp() {cout<<" x=" <<x<<" , y="<<y<<end1;}};void main() {Sample s1, s2(1, 2);s1. disp0;s2. disp ();}
有下列程序:includemain(){ int a=6,b=7,m=1;switch(a%2){ case 0:m++;break;case 1:m 有下列程序:#include<stdio.h>main(){ int a=6,b=7,m=1; switch(a%2) { case 0:m++;break; case 1:m++; switch(b%2) { defaut:m++; case0:m++;break; } } printf("%d\n",m);}程序运行后的输出结果是( )。A.1B.2C.3D.4
有以下程序:include 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<<","; } }; class C : public B,public A { private: int c; public: C(int k) :A(k-2),B(k+2) { c=k; } void disp () { A::disp (); B::disp (); cout<<c<<endl; } }; int main () { C obi (10); obj.disp (); return 0; } 程序执行后的输出结果是A.10,10,10B.10,12,14C.8,10,12D.8,12,10
若有以下程序:include using namespace std;class A{private:int a;public:A(im i){a 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(im i) { a=i; } void disp() cout<<a<<","; } }; class B { private: int b; public: B(int j) { b=j; } void disp0 { cout<<b<<","; } }; class C: public B,public A { private: int c; public: C(int k):A(k-2),B(k+2) { c=k; } void disp0 { A::disp(); B::disp(); cout<<c<<endl; } }; int main() { C obj(10); obj.disp(); return 0; } 程序执行后的输出结果是( )。A.10,10,10B.10,12,14C.8,10,12D.8,12,10
有如下程序: include using namespace std class Base{ int b; public: Base(int i) { 有如下程序:include<iostream>using namespace stdclass Base{int b;public:Base(int i) {b=i;}Void disp ( ) {cout<<"Base:b="<<b<<''; }};class Base1:virtual public Base{public:Base1(int i):Base(i){}};class Base2:virtual public Base{public:Base2(int i):Base(i){}};class Derived:public Basepublic Base1{int d;public:Derived(int i ,int j):Base1(j),Base2(j),【 】{ d=i; }void disp() {cout<<"Derived:d="<<d<<' ';}};int main()Derived objD(1,2);objD. disp()objD. Base::disp();objD. Base1::disp()objD. Base2::disp();return 0;}请将程序补充完整,使程序在运行时输出:Derivd:d=1 Base:b=2 Base:b=2 Base:b=2
下面程序的输出结果是main(){int a=15, b=21,m=0;switch(a%3){ case 0, m++; break;case 1 :m++; switch(b%2) { default: m++; case 0:m++ ;break; }}cout<<m<<end1}A.1B.2C.3D.4
下列程序运行后的输出结果是 ______。 include void main(){ int s=0,k for(k=7;k>=0 下列程序运行后的输出结果是 ______。include<iostream.h>void main(){int s=0,kfor(k=7;k>=0;k--){switch(k){case 1:case 4:case 7:s+ +;break:case 2:case 3:case 6:break;case 0:case 5:s+=2;break;}
有如下程序:include using namespace std;class sample{private: int x, y;public: s 有如下程序: #include <iostream> using namespace std; class sample { private: int x, y; public: sample(int i,int j) { x=i; y=j; } void disp() { cout<<"displ"<<end1; } void disp() const { cout<<"disp2"<<end1; } }; int main () { const sample a(i,2); a.disp (); return 0; } 该程序运行后的输出结果是( )。A.disp1B.disp2C.disp1 disp2D.程序编译时出错
以下程序的输出结果是()。includemain(){int a=8,b=6,m=1;switch(a%4){case 0:m++;brea 以下程序的输出结果是( )。 #include<stdio.h> main() {int a=8,b=6,m=1; switch(a%4) {case 0:m++; break; case 1:m++; switch(b%3) {default:m++; case 0:m++;break; } } printf("%d\n",m);}A.1B.2C.3D.4
写出下列程序代码运行的结果【】。 include class A{public:virtual void disp() {cout 写出下列程序代码运行的结果【 】。include<iostream.h>class A{public:virtual void disp() {cout<<" calss A!" <<(end1;}}:class B: public A{public:void disp() {cout<<" class B! " <<end1:}};class C: public A{public:void disp() {cout<<"class C! " (<end1;}};void main() {A a, *ptr;B b;C c;a. disp();b. disp();c. disp();ptr=b;ptr->disp();ptr=c;ptr->disp():}
若有以下程序:include using namespace std;class Base{private: inta,b;public: Bas 若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void disp () { cout<<a<<" "<<b<<end1; } }; class Derived : public Base { private: int c; int d; public: Derived(int x,int y, int z,int m) :Base(x,y) { c=z; d=m; } void disp () { cout<<c<<" "<<d<<end1; } }; int main() { Base b(5,5),*pb; Derived obj(1,2,3,4); pb=obj; pb->disp(); return 0; } 执行程序后的输出结果是( )。A.1,2B.3,4C.2,3D.5,5
有如下程序:includeusing namespace std;class sample{private:int x,y;public:sampl 有如下程序: #include<iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp() { cout<<"disp1"<<endl; } void disp()const { cout<<"disp2"<<endl; } }; int main() { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是( )。A.disp1B.disp2C.disp1 disp2D.程序编译时出错
以下程序的输出结果是includemain(){ inta=15/b=21,m=0;switch(a%3){ case0:m++;break 以下程序的输出结果是 #include<stdio.h> main() { int a=15/b=21,m=0; switch(a%3) { case0:m++;break; case 1:m ++; switch(b%2) { default:m++; case 0:m ++;break;}} printf("%d\n",m);}A.1B.2C.3D.4
下列程序的输出结果是_______。 main() { int i=3; switch(i) { case1: case 2:printf("%d",i) case 3: case 4:break; default : printf("OK") } }A.0B.3C.OKD.没有任何输出
当前表中含xm(姓名,字符型)字段,显示姓“李”的记录的命令是()A、DISP FOR"李"=xmB、DISP FORxm=李C、DISP FOR SUBS(xm,1,1)=’李’D、DISP FOR SUBS(xm,1,2)=[李]
单选题有如下程序:#include int disp(char *str){ while(*str) putchar(*str++); return *str;}main(){ printf(%d,disp(NAME));}程序运行后的输出结果是( )。ANAME0BNAMEECNAMEDNAME\0
单选题有以下程序:#include int disp(char *str){ while(*str) putchar(*str++); putchar('#'); return *str;}main(){ printf(%d,disp(C##123));}程序运行后的输出结果是( )。AC##123#0BC##1230CC##0DC##123#\0