1 // Hauptprogramm
2 // Datei: rmainfre.cpp
3 #include "ratiofre.hpp"
4
5 int main ()
6 {
7 ratio A,B(1,2),C(1,4);
8
9 cout << "\x1b[2J";
10
cout << "Operatorüberlagerung mit friends\n";
11 cout << "\nAddition (1/2
+ 1/4):\t\t ";
12 A = B + C;
13 cout << A;
14 cout << "\nSubtraktion (1/2
- 1/4):\t ";
15 A = B - C;
16 cout << A;
17 cout << "\nAusgabekette:\t\t
";
18 cout << "\nObjekt A: " << A << " ausgegeben.";
19 return 0;
20 }
|
Bild 9-4: Verwendung des "<<"-Operators für "ratio" |