{"id":22438918,"url":"https://github.com/cypri1-dev/42_cpp02","last_synced_at":"2025-08-05T10:06:04.751Z","repository":{"id":258626665,"uuid":"874289010","full_name":"cypri1-dev/42_CPP02","owner":"cypri1-dev","description":" This project consists of implementing a C++ class following the canonical form of Coplien, which includes a default constructor, copy constructor, assignment operator, and destructor. The goal is to create a Fixed class representing fixed-point numbers, with a fixed precision of 8 bits for the fractional part.","archived":false,"fork":false,"pushed_at":"2024-10-31T10:39:37.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:23:43.489Z","etag":null,"topics":["42","42projects","cpp","cpp02"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cypri1-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-17T15:06:18.000Z","updated_at":"2024-10-31T10:39:41.000Z","dependencies_parsed_at":"2024-10-28T09:26:08.918Z","dependency_job_id":"6bb5c5d2-8688-4229-9d1d-e5017d4f7ead","html_url":"https://github.com/cypri1-dev/42_CPP02","commit_stats":null,"previous_names":["cypri1-dev/42_cpp02"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cypri1-dev/42_CPP02","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP02","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP02/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP02/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP02/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cypri1-dev","download_url":"https://codeload.github.com/cypri1-dev/42_CPP02/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP02/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268874868,"owners_count":24321692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42","42projects","cpp","cpp02"],"created_at":"2024-12-06T01:12:09.501Z","updated_at":"2025-08-05T10:06:04.728Z","avatar_url":"https://github.com/cypri1-dev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## \n\u003ch1\u003e\u003cimg src=\"https://raw.githubusercontent.com/ayogun/42-project-badges/refs/heads/main/covers/cover-cpp-bonus.png\"\u003c/h1\u003e\n\n## Description\nThis project consists of implementing a C++ class following the canonical form of Coplien, which includes a default constructor, copy constructor, assignment operator, and destructor. The goal is to create a Fixed class representing fixed-point numbers, with a fixed precision of 8 bits for the fractional part.\n\n## Exercise 00 - My First Canon\nObjectives 🚀:\n- This exercise introduces you to the canonical form of Coplien in C++.\n- You will create a class that represents a fixed-point number with 8 bits of fractional precision.\n\nRequirement:\n- Create a class named `Fixed` that adheres to the canonical form of Coplien (default constructor, copy constructor, assignment operator, and destructor).\n- Add the following private member: an integer to store the fixed-point number's value - a static constant integer representing the number of bits (always 8) used for the fractional part.\n- Public member functions: a `getRawBits()` function that returns the raw value of the fixed-point number - a `setRawBits(int const raw)` function to set the raw value.\n- In the `main` function, create instances of `Fixed`, copy them, assign values, and print the results using `getRawBits()`.\n\n## Exercise 01 - First Steps Toward a Useful Class\nObjectives 🚀:\n- This exercise builds on the previous one by adding constructors for converting integers and floating-point numbers to fixed-point representation.\n\nRequirements:\n- Extend the `Fixed` class by adding: a constructor that takes an integer and converts it to fixed-point - a constructor that takes a floating-point number and converts it to fixed-point - a `toFloat()` member function to convert the fixed-point number to a floating-point number - a `toInt()` member function to convert the fixed-point number to an integer.\n- Overload the output stream operator (`\u003c\u003c`) to print the fixed-point number in floating-point format.\n- Test these features in the `main` function by creating `Fixed` instances from integers and floating-point numbers, then print their values and conversions.\n\n## Exercise 02 - Now We Can Talk\nObjectives 🚀:\n- This exercise explores operator overloading to perform arithmetic and comparison operations with fixed-point numbers.\n\nRequirements:\n- Overload the following operators for the `Fixed` class: Comparison operators: `\u003e`, `\u003c`, `\u003e=`, `\u003c=`, `==`, `!=` - Arithmetic operators: `+`, `-`, `*`, `/` - Increment/decrement operators: `++`, `--` (both prefix and postfix).\n- Add static member functions `min()` and `max()` to return the smaller or larger of two `Fixed` objects.\n- Test each functionality in the `main` function to ensure proper behavior.\n\n## Exercise 03 - BSP\nObjectives 🚀:\n- This exercise demonstrates how to use the `Fixed` class for practical purposes, such as determining whether a point is inside a triangle using Binary Space Partitioning (BSP).\n\nRequirements:\n- Create a Point class that represents a 2D point using Fixed coordinates.\n- Add the following: Private members for `x` and `y` coordinates (as `Fixed`) - A constructor, copy constructor, assignment operator, and destructor.\n- Implement the function `bool bsp(Point const a, Point const b, Point const c, Point const point)` which determines if `point` is inside the triangle formed by `a`, `b`, and `c`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp02","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcypri1-dev%2F42_cpp02","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp02/lists"}