doc/examples/fixed.cpp
raw| 1 | |
| 2 | #include <fixed-point.h> // FixedPoint class |
| 3 | |
| 4 | int main() |
| 5 | { |
| 6 | // Create an array using the FixedPoint class: |
| 7 | |
| 8 | Array<FixedPoint, 2> A(4,4), B(4,4); |
| 9 | |
| 10 | A = 0.5, 0.3, 0.8, 0.2, |
| 11 | 0.1, 0.3, 0.2, 0.9, |
| 12 | 0.0, 1.0, 0.7, 0.4, |
| 13 | 0.2, 0.3, 0.8, 0.4; |
| 14 | |
| 15 | B = A + 0.05; |
| 16 | |
| 17 | cout << "B = " << B << endl; |
| 18 | |
| 19 | return 0; |
| 20 | } |