feat: finishing the ex02
This commit is contained in:
parent
95fb804997
commit
1179527d22
7 changed files with 373 additions and 13 deletions
44
cpp02/ex02/main.cpp
Normal file
44
cpp02/ex02/main.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 14:41:58 by rparodi #+# #+# */
|
||||
/* Updated: 2024/12/27 13:33:43 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Fixed.hpp"
|
||||
#include <ostream>
|
||||
|
||||
int main( void ) {
|
||||
Fixed a;
|
||||
Fixed const b( 10 );
|
||||
Fixed const c( 42.42f );
|
||||
Fixed const d( b );
|
||||
|
||||
a = Fixed( 1234.4321f );
|
||||
std::cout << std::endl;
|
||||
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 << 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;
|
||||
std::cout << std::endl;
|
||||
std::cout << "a is " << a.toFloat() << " as float" << std::endl;
|
||||
std::cout << "b is " << b.toFloat() << " as float" << std::endl;
|
||||
std::cout << "c is " << c.toFloat() << " as float" << std::endl;
|
||||
std::cout << "d is " << d.toFloat() << " as float" << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "a is " << a.getRawBits() << " as raw" << std::endl;
|
||||
std::cout << "b is " << b.getRawBits() << " as raw" << std::endl;
|
||||
std::cout << "c is " << c.getRawBits() << " as raw" << std::endl;
|
||||
std::cout << "d is " << d.getRawBits() << " as raw" << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue