哪位知道这道题中的空格该填什么。。

C++实验题---填空(类)



#include <iostream>

using namespace std;
class Test
{
Public:
Test(int aa){
______________
}
int Getx(){
_______________
}
private:
int x;
};
int main()
{
int m;
while(cin>>m)
{
Test t(m);
cout<<t.Getx()<<endl;
}
return 0;
}


 

输入

输入有多组测试数据,每行为一组测试数据,且只有一个正整数。

输出

根据程序代码输出相应的信息。

样例输入

100

样例输出

100

 

 


死神的苹果
浏览 1510回答 2
2回答

慕名不来

第一个问是调用构造函数来初始化成员变量          x=aa;第二个是返回成员变量的值    return x;
打开App,查看更多内容
随时随地看视频慕课网APP