网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
在下面程序中,A、B、C、D四句编译时不会出错的是()。include using namespace std;class
在下面程序中,A、B、C、D四句编译时不会出错的是( )。 #include <iostream> using namespace std; class Base{ public: Base(); Base(int e):count(C) {} virtual void print() const = 0; private: int count; }; class Derived :public Base{ public: Derived():Base(0) {} Derived(int C) :Base(C) {} void printt() const{cout<< "Derived"<<endl:} }; void main( ) { Derived d(10); Base *pb; pb = &d; //A Base &cb= d; Derived dd = *pb; //B Derived &cd = cb; //C Base bb = d; //D
A.A
B.B
C.C
D.D
参考答案
更多 “ 在下面程序中,A、B、C、D四句编译时不会出错的是()。include using namespace std;class 在下面程序中,A、B、C、D四句编译时不会出错的是( )。 #include <iostream> using namespace std; class Base{ public: Base(); Base(int e):count(C) {} virtual void print() const = 0; private: int count; }; class Derived :public Base{ public: Derived():Base(0) {} Derived(int C) :Base(C) {} void printt() const{cout<< "Derived"<<endl:} }; void main( ) { Derived d(10); Base *pb; pb = d; //A Base cb= d; Derived dd = *pb; //B Derived cd = cb; //C Base bb = d; //DA.AB.BC.CD.D ” 相关考题
考题
有如下程序:includeusing namespace std;Class TestClass{private:int x,y;public:Te
有如下程序: #include<iostream> using namespace std; Class TestClass { private: int x,y; public: TestClass(int i,int j) { x=i; y=j; } void print() { cout<<“print1”<<endl; } void print()const { cout<<”prinA.printlB.print2C.printl print2D.程序编译时出错。
考题
下面程序的运算结果是()。includeusing namespace std;class A{public:virtual void f
下面程序的运算结果是( )。 #include<iostream> using namespace std; class A { public: virtual void fun()=0; }; class B:public A } public: void fun() {cout<<"new file"<<" ";} }; class C:public A { public: void fun() { cout<<"open file"<<" ";} }; void main() { A a, * p; B b;C c; p=c; p->fun(); p=b; }A.new file open fileB.new file new fileC.编译出错D.open file new file
考题
有以下程序:include include using namespace std;int main ( ){ ofstream
有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);A.程序编译时出错B.abc#C.abcD.#
考题
下面程序运行的结果是()。includeusing namespace std;class A{ protected:int a; pub
下面程序运行的结果是( )。 #include<iostream> using namespace std; class A{ protected: int a; public: void input(int i) {a=i;} }; class B{ protected: int a; public: void input(int j) {a=j;} }; class C: public A, public B { int x; public: void input() {x=A::a * B::a;cout<<x<<endl;} }; void main() { C c; c.A::input(5); c.B::input(8); c.input(); }A.5B.8C.40D.编译出错
考题
有以下程序 #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.9C.21D.9
考题
有下列程序:includeusing namespace std;class TestClass{private:int x,y;public:Te
有下列程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"printl"<<endl; } voA.print1B.print2C.pfint1 print2D.程序编译时出错
考题
下面程序的结果是 ______。includeclass A{ public:virtual voidfun()=0{};};class
下面程序的结果是 ______。 #include<iostream.h> class A{ public: virtual void fun()=0{}; }; class B:public A{ public: void fun () {cout<< "new file" ;} }; class C: public A{ public: void fun (){cout<<"open file"<< " " } }; class D: public A{ public: void fun () {cout<< "save file\n" ;} }; void main() { A a,*p; B b; C c; D d; p=c; p->fun (); p=b; p->fun (); p=d; p->fun(); }A.new file open file save fileB.new file new file new fileC.编译出错D.open file new file save file
考题
对下面的程序,说法正确的是()。includeusing namespace std;void sum(float m, float
对下面的程序,说法正确的是( )。 #include<iostream> using namespace std; void sum(float m, float n) { float sum=m+n; } main() { cout<<sum(5.3,6.5)<<endl;}A.该程序是错误的,错误之处在于没有对sum()函数进行说明B.程序书写规整,无语法错误,是正确的C.该程序语法无错误,但在调用函数sum()时出错,因为sum()函数被定义为viod类型,但却被主函数调用,因而是错误的D.虽然sun()函数被定义为void类型,但调用时也不会出错,程序能够编译通过
考题
下面代码是否正确?// 以C++17标准编译 #include <iostream> int main() { if (int x {10}; x-- > 0) { x--; } std::cout << x; return 0; }
热门标签
最新试卷