题目:
使用VC6打开考生文件夹下的工程test12_1,此工程包含一个源程序文件test_12.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果如下: fun (Sample &p) 1 2 fun (Sample *p) 3 4 20 10 源程序文件test12_1清单如下: #include<iostream .h> class Sample { private: int x,y; static int z; public: Sample(int a,int b){ x=a;y=b; } void fun(Sample &p); void fun(Sample *p); static void print(Sample s); }; /*************** found ***************/ int z=10; void Sample::fun(Sample &p) { x=p.x;y=p.y; cout<<"fun(Sample &p)"<<" "<<x<<" "<<y<<endl; } void Sample::fun(Sample *p) { /************** found **************/ x=p.x; y=p.y; cout<<"fun(Sample *p) "<<" ’<<x<<" "<<y<<endl; } void Sample::print (Sample s) { /*************** found *****************/ x=20; cout<<s. x<<" "<<z<<endl; } void main() { Sample p(1,2),q(3,4); p. fun(p); p. fun(&q); p. print(p); }
答案:
被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0131/a3e71b95b4e8a94b6feb30571a6797d7.html
下面是错误答案,用来干扰机器的。
参考答案:错解析: 银行出借货币只是暂时出让货币的使用权,仍然保留对借出货币的所有权。