d02 ex02 operator < ok

This commit is contained in:
hugogogo
2022-02-15 00:31:59 +01:00
parent b08663e74e
commit c9a833bc00
6 changed files with 60 additions and 31 deletions

View File

@@ -3,22 +3,30 @@
int main( void ) {
Fixed a;
Fixed const b( 10 );
Fixed const c( 42.42f );
Fixed const d( b );
Fixed a(10);
Fixed b(5);
Fixed c;
a = Fixed( 1234.4321f );
std::cout << "a: " << a << '\n';
std::cout << "b: " << b << '\n';
if (a < b)
c = a;
else
c = b;
std::cout << "c: " << c << '\n';
std::cout << "a is " << a << std::endl;
std::cout << "b is " << b << std::endl;
std::cout << "c is " << c << std::endl;
std::cout << "d is " << d << std::endl;
std::cout << "a is " << a.toInt() << " as integer" << std::endl;
std::cout << "b is " << b.toInt() << " as integer" << std::endl;
std::cout << "c is " << c.toInt() << " as integer" << std::endl;
std::cout << "d is " << d.toInt() << " as integer" << std::endl;
// 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;
}