Files to submit
Authorized
Definition of done
Add public member functions to the class to overload the following operators:
Testing
Running this code:
#include <iostream>
int main( void ) {
Fixed a;
Fixed const b( Fixed( 5.05f ) * Fixed( 2 ) );
std::cout << a << std::endl;
std::cout << ++a << std::endl;
std::cout << a << std::endl;
std::cout << a++ << std::endl;
std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << Fixed::max( a, b ) << std::endl;
return 0;
should output something like this:
$> ./a.out
0
0.00390625
0.00390625
0.00390625
0.0078125
10.1016
10.1016
$>
If the program crashes when dividing by 0, it's acceptable.
Files to submit
ex02/dirAuthorized
<cmath>Definition of done
Add public member functions to the class to overload the following operators:
>,<,>=,<=,==and!=)+,-,*and/)ϵ, such that1 + ϵ > 1)minthat takes two references to fixed-point numbers as parameters and returns a reference to the smallest oneminthat takes two references to constant fixed-point numbers as parameters and returns a reference to the smallest onemaxthat takes two references to fixed-point numbers as parameters and returns a reference to the greatest onemaxthat takes two references to constant fixed-point numbers as parameters and returns a reference to the greatest oneTesting
Running this code:
should output something like this: