xsnippet logotype

xsnippet

#362513, Untitled [ C++ ]

by Guest
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>

using namespace std;

class Timer
{
public:
	int a, *pa = &a;
	void funcTimer(int at, int bt, int ct)
	{
		a = at;
		b = bt;
		c = ct;
	};
	void funcTResult()
	{
		cout << "a=" << a << " b=" << b << " c=" << c << endl;
	};
private:
	int b;
protected:
	int c, *pc = &c;
};
class Clock : public Timer
{
public:
	int x, *px = &x;
	void funcClock(int xt, int yt, int zt)
	{
		x = xt;
		y = yt;
		z = zt;
	};
	void funcCResult()
	{
		cout << "a=" << *pa << " c=" << *pc << " x=" << x << " y=" << y << " z=" << z << endl;
	};
private:
	int y;
protected:
	int z, *pz = &z;
};
class Hand : public Clock
{
public:
	int i, *pi = &i;
	void funcHand(int it, int jt, int kt)
	{
		i = it;
		j = jt;
		k = kt;
	};
	void funcHResult()
	{
		cout << "a=" << *pa << " c=" << *pc << " x=" << *px << " z=" << *pz << " i=" << i << " j=" << j << " k=" << k << endl;
	};
private:
	int j;
protected:
	int k, *pk = &k;
};

void main()
{
	int a, b, c, x, y, z, i, j, k;
	cout << "a=";	cin >> a;
	cout << "b=";	cin >> b;
	cout << "c=";	cin >> c;
	cout << "x=";	cin >> x;
	cout << "y=";	cin >> y;
	cout << "z=";	cin >> z;
	cout << "i=";	cin >> i;
	cout << "j=";	cin >> j;
	cout << "k=";	cin >> k;
	Timer A; Clock B; Hand C;
	A.funcTimer(a, b, c);
	A.funcTResult();
	B.funcClock(x, y, z);
	B.funcCResult();
	C.funcHand(i, j, k);
	C.funcHResult();
}