creation d02 ex02

This commit is contained in:
hugogogo
2022-02-14 21:06:36 +01:00
parent 9036ded700
commit b08663e74e
9 changed files with 310 additions and 81 deletions

35
d02/ex02/Fixed.hpp Normal file
View File

@@ -0,0 +1,35 @@
#ifndef FIXED_HPP
# define FIXED_HPP
#include <iostream>
#include <string>
#include <cmath>
class Fixed {
public:
Fixed(void); // default/parametric constructor
Fixed(Fixed const & src); // copy constructor
~Fixed(void); // destructor
Fixed(int integer);
Fixed(float const floater);
Fixed & operator=(Fixed const & rhs); // assignement operator
int getRawBits(void) const;
void setRawBits(int const raw);
float toFloat(void) const;
int toInt(void) const;
private:
int _value;
static int const _frac;
static int const _max;
};
std::ostream & operator<<(std::ostream & out, Fixed const & fixed);
#endif