Developing ex00
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Fixed.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/10 00:54:50 by tigos #+# #+# */
|
||||
/* Updated: 2025/09/10 00:57:12 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Fixed.hpp"
|
||||
|
||||
// Default constructor
|
||||
|
||||
// Copy constructor
|
||||
|
||||
// Copy assignment operator overload
|
||||
|
||||
// Destructor
|
||||
|
||||
// int getRawBits( void ) const;
|
||||
|
||||
// void setRawBits( int const raw );
|
||||
@@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Fixed.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/10 00:54:53 by tigos #+# #+# */
|
||||
/* Updated: 2025/09/10 00:56:56 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FIXED_HPP
|
||||
|
||||
# define FIXED_HPP
|
||||
|
||||
# include <iostream>
|
||||
|
||||
class Fixed
|
||||
{
|
||||
private:
|
||||
int value;
|
||||
static const int fract;
|
||||
|
||||
public:
|
||||
// Default constructor
|
||||
|
||||
// Copy constructor
|
||||
|
||||
// Copy assignment operator overload
|
||||
|
||||
// Destructor
|
||||
|
||||
// int getRawBits( void ) const;
|
||||
|
||||
// void setRawBits( int const raw );
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
NAME = fixed
|
||||
|
||||
SRCS = main.cpp Fixed/Fixed.cpp
|
||||
OBJS=$(SRCS:.cpp=.o)
|
||||
|
||||
CC=c++
|
||||
CFLAGS=-Wall -Wextra -Werror -std=c++98
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) -o $(NAME)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: all clean fclean re
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/10 00:54:19 by tigos #+# #+# */
|
||||
/* Updated: 2025/09/10 01:05:59 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Fixed/Fixed.hpp"
|
||||
|
||||
int main( void ) {
|
||||
|
||||
Fixed a;
|
||||
Fixed b( a );
|
||||
Fixed c;
|
||||
|
||||
c = b;
|
||||
|
||||
std::cout << a.getRawBits() << std::endl;
|
||||
std::cout << b.getRawBits() << std::endl;
|
||||
std::cout << c.getRawBits() << std::endl;
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user