查题网
高校
面向对象程序设计
截止11-06,该科目累计收录道题目。
返回课程列表
19[分析题] #include<iostream.h> void fun10(int *a[],int m,int n) { int i,j; for(i=0;i<m;i ) a[i]=new int [n]; for(i=0;i<m;i ) for(j=0;j<n;j ) a[i][j]=(i 1)*(j 1); } void main() {int m1=2,n1=2; int **b=new int *[m1]; fun10(b,m1,n1); for(int i=0;i<m1;i ){ for(int j=0;j<n1;j ) cout<<b[i][j]<<’ ’; cout<<endl; } }
查看答案
2022-06-19 17:25:19
20[分析题] #include “iostream.h” class A{ public: A( ) { cout<<”A begins” ; } ~A( ) { cout<<”A ends”; } void print( ) { cout<<”I am A”; } virtual void show() { cout<<”A is great”; } } }; class B :public A{ public: B( ) { cout<<”B begins” ; } ~B( ) { cout<<”B ends” ; } void print ( ) { cout<<”I am B” ; } void show() { cout<<”B is great” } }; void main( ) { A obj_b; A *p; p=new B; p->show(); p=&obj_b; p->print(); }
查看答案
2022-06-19 17:25:19
21[分析题] class Student { int studentNo; static int count; public: Student() { count ;StudentNo=count;} void print(){ cout<<StudentNo<<endl; }};int Student::count=0;main(){ Student student1; student1.print(); Student student2;student2.print();student *p;p= new Student;p->print();}
查看答案
2022-06-19 17:25:19
22[分析题] #include enum race{Black,White,Yellow}; void main() { race ra; ra=Black;cout< ra=White;cout< ra=Yellow;cout< cout< }
查看答案
2022-06-19 17:25:19
23[分析题] #include<iostream.h> classA { int a,b; public: A(){ a=b=0; } A(int aa,int bb){ a=aa;b=bb; cout<<a<<’ ‘<<b<<endl; }}; void main(){ A x, y(2,3), z(4,5); }
查看答案
2022-06-19 17:25:19
24[分析题] #include<iostream.h> #define PI 3.14159 const int R=10 void main() { double p,s; p=2*R*PI; s=PI*R*R; cout<<”p=”<<p<<endl; cout<<”s=”<<s<<endl; }
查看答案
2022-06-19 17:25:19
25[分析题] #include<iostream.h> class A { int a,b; public: A(int aa=0,int bb=0):a(aa),b(bb){ cout<<”Constructor!”<<a b<<endl; }}; void main(){ A x, y(2,3), z(y); }
查看答案
2022-06-19 17:25:19
1[填空题] 类定义中,缺省的成员是________成员.
查看答案
2022-06-19 17:25:12
1[填空题] c 程序有且必须有一个 __________ 函数
查看答案
2022-06-19 17:25:06
1[填空题] 生明域名空间的关键字是 __________ .
查看答案
2022-06-19 17:24:59
首页
上一页
...
49
50
51
(current)
52
53
...
下一页
尾页