A-A+

分析以下程序的执行结果【 】。 include <iostream. h> class S{

2022-08-05 23:12:52 问答库 阅读 173 次

问题详情

分析以下程序的执行结果【 】。
include <iostream. h>
class S{
int A[10];
public:
int &operator () (int);
};
int &S: :operator() (int x) {
return A[x];
}
void main() {
S a;
int i,j;
for (i=0; i<10; i++)
a(i)=i*2;
for (i=0; i<10; i++)
cout<<a(i)<<" ";
cout<<end1; }请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:0 2 4 6 8 10 12 14 16 18
0 2 4 6 8 10 12 14 16 18

考点:结果,程序