// proj3.C - A Sample Main for Testing Fixed Point Arithmetic // // Author: James Kukla // Date: 3/6/2000 #include #include "Fixed.H" void main(void) { // Declare some Fixed point values. Fixed a(14.45), b=37.67, c=1.57; // Print the initial values. cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; // Test basic arithmetic ... cout << "Testing fixed-point arithmetic..." << endl; cout << "\ta + b = " << a+b << endl; cout << "\ta - b = " << a-b << endl; cout << "\ta * b = " << a*b << endl; cout << "\ta / b = " << a/b << endl; cout << "cast to float: " << float(c) << endl; cout << "Testing trigonometric functions..." << endl; cout << "\tsin: " << sin(c) << endl; cout << "\tcos: " << cos(c) << endl; cout << "\tatan: " << atan(c) << endl; }