自考新教材-p145_5

源程序:

#include <iostream>
using namespace std;
class f
{
private:
int x, y;
public:
void f1()
{
x = 10;
y = 10;
}
void print()
{
cout << x << "," << y << endl;
}
};
int main()
{
f a;
a.f1();
a.print();
system("pause");
return 1;
}

运行结果:

 

posted @ 2020-02-06 19:52  bobo哥  阅读(135)  评论(0编辑  收藏  举报