一个简单的c++程序--关注程序结构

源程序:

#include <iostream>
using namespace std;

class Test
{
private:
int Width,Height;
public:

//以下是函数
void SetValue(int iWidth,int iHeight)
{
Width=iWidth;
Height=iHeight;
}

float GetValue(void)
{
return Width*Height;
}
};

int main()
{
Test T;
T.SetValue(10,20);
cout<<T.GetValue()<<endl;
return 1;
}

 运行结果:200

posted @ 2020-12-15 19:11  bobo哥  阅读(104)  评论(0编辑  收藏  举报