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

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

【单选题】下列程序运行结果为______。 #include<iostream> using namespace std; class S { public: ~S() { cout<<"S"<< "t"; } }; char fun0() { S s1; throw('T'); return '0'; } int main() { try { cout<<fun0()<< "t"; } catch(char c) { cout<<c<< "t"; } return 0; }

A.S T

B.O S T

C.O T

D.T


参考答案和解析
D
更多 “【单选题】下列程序运行结果为______。 #include<iostream> using namespace std; class S { public: ~S() { cout<<"S"<< "t"; } }; char fun0() { S s1; throw('T'); return '0'; } int main() { try { cout<<fun0()<< "t"; } catch(char c) { cout<<c<< "t"; } return 0; }A.S TB.O S TC.O TD.T” 相关考题
考题 以下程序的输出结果是【】。 include using namespace std; int main() {char S[]="abcde 以下程序的输出结果是【 】。include <iostream>using namespace std;int main(){char S[ ]="abcdef";s[3]='\0';cout<<s<<end1;return 0;}

考题 下列程序的输出结果是______。 include include using namespace std; voi 下列程序的输出结果是______。include<iostream.h>include<string.h>using namespace std;void fun(const char*s,char C) {c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

考题 执行下面程序输出的是【】。 include using namespace std;template T tot 执行下面程序输出的是【 】。include <iostream>using namespace std;template <typename T>T total(T *data){Ts=0;while( *data) s+=*data++;return s;}int main(){int s[]={1,3,5,7,0,2,4,6,8};cout<<total(s);return 0;}

考题 有如下程序 include using namespace std; class Base { protected: 有如下程序 #include <iostream> using namespace std; class Base { protected: Base( ){cout<<'A'; } Base(char c) { cout<<c; } }; class Derived: public Base { public: Derived(char c){ cout<<c; } }; int main( ){ Derived d1 ('B'); return 0; } 执行这个程序屏幕上将显示输出A.BB.BAC.ABD.BB

考题 有如下程序: include using namespaee std;class Animal{ public: virtual char*g 有如下程序:include<iostream>using namespaee std;c lass Animal{public:virtual char*getType( )const{return"Animal";}virtual char*getVoice( )const{return"Voice";}};class Dog:public Animal{public:char*getType( )const{return"Dog";}char*getVoice( )eonst{return"Woof";}};void type(AnimalA) {cout<<a.getType( );}void speak(Animal A) {eout<<a.getVoice( );}int main( ){Dog d;type(D) ;cout<<"speak";speak(D) ;cout return 0;}程序的输出结果是______。

考题 在下面程序横线处填上适当内容,以使该程序执行结果为4.4。includeusing namespace std; 在下面程序横线处填上适当内容,以使该程序执行结果为4.4。include<iostream>using namespace std;template<typename T>T average(T*datA){T s=0;int i:0;while(data[i])【 】;return s/(i+1);}int main(){double x[]={2.5,4.5,6.5,5,0.0,5,3,18.5};cout<<average(X);return 0;}

考题 有以下程序include using namespace std;class sample{private:int x;public:sample( 有以下程序#include <iostream>using namespace std;class sample{private: int x;public: sample(int a) { x=a; } friend double square(sample s);};double square(sample s){ return s. x*s. x;}int main(){ sample s1(20),s2(30); cout<<square(s2)<<end1; return 0;}执行结果是( )。A.20B.30C.900D.400

考题 下列程序的输出结果是【】 includeusing namespace std; template T total 下列程序的输出结果是【 】include<iOStream>using namespace std;template <typename T>T total (T*datA){T s=0;while(*datA){s+=*data++;}return s;}int main(){int x[]={2,4,6,8,0,12,14,16,18};cout<<total(x)<<end1;return 0;}

考题 下面程序运行输出的结果是【】。 include using namespace std; int main(){char a[]="C 下面程序运行输出的结果是【 】。include <iostream>using namespace std;int main(){char a[]="Chinese";a[3]='\0';cout<<a<<endl;return 0;}

考题 以下程序的输出结果是【】。 include using namespace std; int main() {int s,i;for(s= 以下程序的输出结果是【 】。include <iostream>using namespace std;int main(){int s,i;for(s=0,i=1;i<3;i++)s+=i;cout<<s<<end1;return 0;}

考题 有如下程序:includeusing namespace std;class Base{protected:Base(){cout 有如下程序: #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'Base';} Base(char c){cout<<c;} }; class Derived:public Base{ public: Derived(char c){cout<<c;} }; int main(){ Derived d('Derived'); return 0; } 执行这个程序屏幕上将显示输出( )。A.DerivedB.DerivedBaseC.BaseDerivedD.DerivedDerived

考题 下列程序的输出结果是【】。 include using namespace std; class A {int a; public:A() 下列程序的输出结果是【 】。include <iostream>using namespace std;class A {int a;public:A():a(9){}virtual void print() const { cout<<a;};};class B: public A {char b;public:B( ){b='S';}void print() const {cout<<b;}};void show(A x){ x.print0;}int main(){ Ad1,*p;B d2;p=d2;d1.print();d2.print0;p->print();show(d1);show(d2);return 0;}

考题 以下程序的输出结果是()。includeusing namespace std;void fun(char**q){++q;cout 以下程序的输出结果是( )。 #include<iostream> using namespace std; void fun(char**q) { ++q; cout<<*q<<end1; } main() { static char*s[]={"HI","HELL0","TEST"}; char**p; p=s; fun(p); system("PAUSE"); return 0; }A.为空B.HIC.HELL0D.TEST

考题 有如下程序:includeincludeusing namespace std;class TestClass{public;T 有如下程序: #include<iostream> #include<iomanip> using namespace std; class TestClass{ public; TestClass (){cout<<'A';} TestClass(char C){cout<<c;) ~TestClass (){cout<<'B';} }; int main(){ TestClass p1,*p2; p2=new TestClass('X'); delete p2; return 0; } 执行这个程序的结果是( )。A.ABXB.ABXBC.AXBBD.AXB

考题 有如下程序: include using namespace std; template T total(T * data) 有如下程序:include<iostream>using namespace std;template<typename T>T total(T * data) {T s=0;While(* data)s+ = *data + +;return s;}int main(){int x[]:{2,4,6,8, 10, 12, 14, 16, 18};cout<<total(x);

考题 下列程序的输出结果是【】。 include include using namespace std; void fun(c 下列程序的输出结果是【 】。include<iostream>include<cstring>using namespace std;void fun(const char *s,char c){c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

考题 有如下程序:includeusing namespace std;class Name{char name[20];public:Name( ){s 有如下程序: #include<iostream> using namespace std; class Name{ char name[20]; public: Name( ){strepy(name," ");tout<<'?';} Name(char*fname){strcpy(name,fname);cout<<'?';} }; int main( ){ Name name[3]={Name("张三"),Name("李四")}; return 0; } 运行此程序输出符号“?”的个数是A.0B.1C.2D.3

考题 下列程序的输出结果是______。includeinclude using namespace std;void 下列程序的输出结果是______。include <iostream.h>include <cstring.h>using namespace std;void fun(const char*s,char C) {c=s[strlen (s)/2];}int main {){char str [] ="ABCDE";char ch=str[1];fun(str,sh);cout<<Ch;return 0;}

考题 有如下程序: include using namespace std; class Sac{ int n; public: Sac():n(4){co 有如下程序:include<iostream>using namespace std;class Sac{int n;public:Sac():n(4){cout<<n;}Sac(int k):n(k){cout<<n;}~Sac(){cont<<n+n;}};int main(){Sac s1,*s2;s2=new Sac(3);delete s2;return 0;}运行时的输出结果是______。

考题 有以下程序include using namespace std; class sample { private: int x; public: 有以下程序 #include <iostream> using namespace std; class sample { private: int x; public: sample(int a) { x=a; } friend double square(sample s); }; double square(sample s) { return s.x*s.x; } int main() { sample s1 (20),s2(30); cout<<square(s2)<<end1; return 0; } 执行结果是A.20B.30C.900D.400

考题 有如下程序: include using namespaee std; class A{ public: A( ){cout 有如下程序:include<iostream>using namespaee std;class A{public:A( ){cout<<"A";}~A( ){cout<<"A";}};class B{A a;public:B( ){cout<<"B";}~B( )t cout<<"B";}};int main( ){B b;return 0;}程序的输出结果是______。

考题 有以下程序includeusing namespace std;class sample{private: int x;public: sample 有以下程序 #include<iostream> using namespace std; class sample { private: int x; public: sample(int a) { x=a; } friend double square(sample s); }; double square(sample S) { return s.x*s.x; } int main() { sample s1(20),s2(30); cout<<square(s2)<<endl; return 0; } 执行结果是A.20B.30C.900D.400

考题 有如下程序:include using namespace std;class A {public: A() {cout 有如下程序: #include <iostream> using namespace std; class A { public: A() {cout<<"A";} }; class B {public:B() {cout<<"B";}}; class C: public A { Bb; public: C() {cout<<"C";} }; int main() {C obj;return 0;}执行后的输出结果是 ______。A.CBAB.BACC.ACBD.ABC

考题 有如下程序:includeusing namespace std;class Toy{public:Toy(char*_n){strcpy(name 有如下程序: #include<iostream> using namespace std; class Toy{ public: Toy(char*_n){strcpy(name,_n);count++;} ~Toy(){count--;} char*GetName( ){return name;} static int getCount( ){return count;} private: char name[10]; static int count; }; int Toy::count=0: int main( ){ Toy tl("Snoopy"),t2("Mickey"),t3("Barbie"); cout<<t1.getCount( )<<endl; return 0; } 程序的输出结果是A.1B.2C.3D.运行时出错

考题 有以下程序:include using namespace std;int main ( ){ char s1[10],s2[10]; char*p 有以下程序: #include <iostream> using namespace std; int main ( ) { char s1[10],s2[10]; char *p=s1,*q=s2; cin>>s1>>s2; while (*p ! =' \0 ' ) p++; while (*q!='\0') *p++=*q++; *p='\0'; cout<<s1<<end1; return 0; }A.abcd0ghijB.abcd0ghij0C.abcdD.abcdghij

考题 有以下程序:include include using namespace std;int main (){ char s[]=" 有以下程序: #include <iostream> #include <string> using namespace std; int main () { char s[]="\n123\\"; cout<<strlen (s) <<", "<<sizeof (s) <<end1; return 0; }A.赋初值的字符串有错B.6,7C.5,6D.6,6

考题 有如下程序:include using namespace std;class A{public:A(){cout 有如下程序: #include <iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B {public:B(){cout<<"B";} }; class C:public A { B b; public:C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )。A.CBAB.BACC.ACBD.ABC

考题 下列程序段的执行结果为()。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