自考新教材-p88_4(2)

源程序:

#include <iostream>
using namespace std;
class Test
{
int a, b;
int getmin()
{
return (a < b) ? a : b;
}
public:
int c;
void setValue(int x1, int x2, int x3)
{
a = x1;
b = x2;
c = x3;
}
int GetMin();
};
int Test::GetMin()
{
int d = getmin();
return (d = d < c ? d : c);
}
int main()
{
Test t1;
t1.setValue(34,6,2);
cout << t1.GetMin() << endl;
system("pause");
return 1;
}

运行结果:

 

posted @ 2020-02-06 14:58  bobo哥  阅读(129)  评论(0编辑  收藏  举报