33 lines
542 B
C++
33 lines
542 B
C++
#include <iostream>
|
|
using namespace std;
|
|
class TS {
|
|
public:
|
|
TS(int n = 0, int d = 0);
|
|
void Print();
|
|
// ____________________________ // Blank 1
|
|
|
|
friend TS Div(TS &r1, TS &r2);
|
|
private:
|
|
int N, D;
|
|
};
|
|
|
|
TS Div(TS &r1, TS &r2) {
|
|
return TS(r1.N / r2.D + r1.D / r2.N, r1.D / r2.D);
|
|
}
|
|
|
|
TS::TS(int n, int d) {
|
|
N = n;
|
|
D = d;
|
|
}
|
|
|
|
//__________Print() { //Blank 2
|
|
void TS::Print() {
|
|
cout << "N=" << N << " D=" << D << endl;
|
|
}
|
|
|
|
int main() {
|
|
TS a(1, 2), b(3, 4), c;
|
|
c = Div(a, b);
|
|
c.Print();
|
|
return 0;
|
|
} |