- #1
FallArk
- 127
- 0
The way the classes and functions are named confuses me. What is the program trying to do?
The first 20 random numbers are:
11527,4365,19738,9290,29090,29206,21427,28828,21650,14538,23366,
18453,32723,11594,31040,24829,11476,20054,28717,30531
Code:
class Y {
long y;
public:
Y() {
y = 4;
}
long get(long yy) {
long ret = yy * y;
y = yy;
return ret;
}
};
class X {
long x;
Y y;
public:
X() {
x = 7;
}
void Xx(long xx) {
x += y.get(xx);
}
int get() {
return x;
}
};
int main() {
X q;
for (int z = 0; z < 11; z++) {
q.Xx(rand()%93);
}
cout << q.get() << endl;
}
The first 20 random numbers are:
11527,4365,19738,9290,29090,29206,21427,28828,21650,14538,23366,
18453,32723,11594,31040,24829,11476,20054,28717,30531