问答题
b. display();
【参考答案】
(1)
size=s;
buffer=new int[size];
(2)
......
(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
问答题
请编写一个函数int fun (int nFirst, int nSecond),求两个数的最小公倍数并返回这个值。注意:部分源程序已存在文件test13_2.cpp中。如输入7和8时,结果是56。请勿修改主函数main和其他函数中的任何内容,仅在函数fun的花括号中填写若干语句。文件test13_2的内容如下; #include<iostream.h> int fun(int nFirst,int nSecond); void main() int nFirst,nSecond; cout<< Please input the first one ; cin>>nFirst; cout<< Please input the second one ; cin>>nSecond; cout<< 最小公倍数: <<fun(nFirst,nSecond)<<endl; int fun(int nFirst,int nSecond)
点击查看答案&解析
问答题
使用VC6打开考生文件夹下的工程test13_1,此工程包含一个源程序文件test13_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果如下: n=2 n=5 n=7 源程序文件test13_1清单如下: #include<iostream.h> class Sample int n; public: *************** found ************+*** Sample() Sample(int i)n=i; ***************** found ********+********** void add(Sample s1,Sample s2) ***************** found **************** this.n=s1->n+s2.n; void disp()cout<< n= <<n<<endl; ; void main() Sample s1(2),s2(5),s3; s3.add(&s1,s2); s1.disp(); s2.disp(); s3.disp();
点击查看答案&解析
相关试题
使用VC6打开考生文件夹下的工程test13_...
请编写一个函数int fun (int nFirst,...