{"id":16550315,"url":"https://github.com/sylhare/cpp","last_synced_at":"2025-03-04T15:27:23.992Z","repository":{"id":92385034,"uuid":"123809492","full_name":"sylhare/Cpp","owner":"sylhare","description":"C++ small projects","archived":false,"fork":false,"pushed_at":"2019-07-11T23:08:14.000Z","size":6014,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T20:22:12.057Z","etag":null,"topics":["beginner","cpp","game","tutorial"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sylhare.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-03-04T16:59:09.000Z","updated_at":"2024-01-19T15:42:04.000Z","dependencies_parsed_at":"2023-05-17T02:00:18.915Z","dependency_job_id":null,"html_url":"https://github.com/sylhare/Cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylhare%2FCpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylhare%2FCpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylhare%2FCpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sylhare%2FCpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sylhare","download_url":"https://codeload.github.com/sylhare/Cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241871002,"owners_count":20034382,"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","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":["beginner","cpp","game","tutorial"],"created_at":"2024-10-11T19:33:50.760Z","updated_at":"2025-03-04T15:27:23.973Z","avatar_url":"https://github.com/sylhare.png","language":"C++","readme":"# C++\n\nC++ is an evolution of the C language but with more modern features for a more diverse use than the C.\n\n## Introduction\n\nC++ is a low level programming language, meaning that it is closer to the computer internal mechanism (close to the metal).\nThis language strength are:\n\n- Fast - for high performance software\n- Multiplatform - can be executed in Windows, MacOS, Linux without code transoformation\n- It has [imperative](https://en.wikipedia.org/wiki/Imperative_programming), [object-oriented](https://en.wikipedia.org/wiki/Object-oriented_programming) and [generic](https://en.wikipedia.org/wiki/Generic_programming) programming features\n- Famous - it is used for multiple applications and has a lot of librairies available\n\n## Getting Started\n\nTo start coding in c++ you would need three things:\n    - A text editor\n    - A compiler\n    - A debugger\n\nThanksfully there are options where all three are integrated in an IDE (Integrated Development Environment).\nA standard and famous IDE to use would be [code::blocks](http://www.codeblocks.org/downloads/26). If you are on windows, choose the version with [MinGW] which is a c++ compiler.\nIf you are on Linux (debian, ubuntu):\n\n```bash\napt-get install build-essential codeblocks\n```\n\nYou can open the IDE and start writing your programms in a `.cpp` file.\n\n## Tips\n\n### Don't try to optimize blindly\n\nCheck what takes time first. Most of the programming optimization is done via the compiler.\n\n### Don't use `std::endl` if `\\n` will do\n\nUsing `std::endl` emits a `\\n` and flushes the stream. Unless you really need the stream flushed.\n`std::endl` is potentially more computationally costly.\n\n### Don't abuse using `namespace std`\n\nPutting using namespace std at the top of every program is a bad habit. \nConsider this: you are using two libraries called Foo and Bar:\n\n    using namespace foo;\n    using namespace bar;\n\n\nEverything works fine, you can call `Blah()` from Foo and `Quux()` from Bar without problems. But one day you upgrade to a new version of Foo, which now offers a function called `Quux()`. Now you've got a conflict: Both Foo 2.0 and Bar import `Quux()` into your global namespace. This is going to take some effort to fix, especially if the function parameters happen to match.\n\nIf you had used `foo::Blah()` and `bar::Quux()`, then the introduction of `foo::Quux()` would have been a non-event.\n\n### The \"`return 0;`\" is optionnal for main \n\nFor C++, since the first standard in 1998; see ISO/IEC 14882:1998 section 3.6.1:\n\n\u003e If control reaches the end of main without encountering a return statement, the effect is that of executing return 0;\n\n\n## Calculator\n\n![calculator!](https://raw.githubusercontent.com/Sylhare/Cpp/master/resources/calculator.png)\n\nSimple Calculator, that does simple calculations, don't expect too much though.\n\nIt implements:\n\n- (っ◔◡◔)っ ♥ `Love` ♥\n- Standard operation default in `c++`\n- `\u003ciostream\u003e` for input and output\n- `\u003ccmath\u003e` for more complex math operation \n\n### Sources\n\n- [Openclassroom - C++](https://openclassrooms.com/courses/programmez-avec-le-langage-c)\n\n\n## Minesweeper\n\n```bash\n   \t___  ___  _____   _   _   _____   _____   _    _   _____   _____  ______   _____  ______ \n\t|  \\/  | |_   _| | \\ | | |  ___| /  ___| | |  | | |  ___| |  ___| | ___ \\ |  ___| | ___ \\\n\t| .  . |   | |   |  \\| | | |__   \\ `--.  | |  | | | |__   | |__   | |_/ / | |__   | |_/ /\n\t| |\\/| |   | |   | . ` | |  __|   `--. \\ | |/\\| | |  __|  |  __|  |  __/  |  __|  |    / \n\t| |  | |  _| |_  | |\\  | | |___  /\\__/ / \\  /\\  / | |___  | |___  | |     | |___  | |\\ \\ \n\t\\_|  |_/  \\___/  \\_| \\_/ \\____/  \\____/   \\/  \\/  \\____/  \\____/  \\_|     \\____/  \\_| \\_|\n```\t                                                                                                                                        \n\nChallenge from google, to recreate a minesweeper.\nThere's the challenge and the solution.\n\nI have made one [minesweeper in javascript](https://sylhare.github.io/Minesweeper/) that is fully functionnal and better looking.\n\n\n### Source\n\n- [Google's dev camp](https://techdevguide.withgoogle.com/paths/foundational/sequence-2/coding-question-minesweeper/#)\n- [Solving minesweeper with Matrics](https://massaioli.wordpress.com/2013/01/12/solving-minesweeper-with-matricies/)\n- [Sylhare - Minesweeper](https://github.com/Sylhare/Minesweeper)\n\n\n## Conway's game of life\n\n![life!](https://raw.githubusercontent.com/Sylhare/Cpp/master/resources/conway-gof.gif)\n\nThe Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970.\n\n### Rules\n\nThe universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead, or \"populated\" or \"unpopulated\". \n\nEvery cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:\n\n- Any live cell with fewer than two live neighbours dies, as if caused by **underpopulation**.\n- Any live cell with two or three live neighbours lives on to the **next generation**.\n- Any live cell with more than three live neighbours dies, as if by **overpopulation**.\n- Any dead cell with exactly three live neighbours becomes a live cell, as if by **reproduction**.\n\n### Implementation\n\nA cell   **C**   is represented by a   **1**   when alive,   or   **0**   when dead,   in an   **m×m**   square array of cells.\n\nWe calculate   N   (the sum of live cells in C's eight-location neighbourhood), the state of the cell   C   is then dead or alive in the next generation based on the following table:\n```\n   C   N                 new C\n   1   0,1             -\u003e  0  # Lonely\n   1   4,5,6,7,8       -\u003e  0  # Overcrowded\n   1   2,3             -\u003e  1  # Lives\n   0   3               -\u003e  1  # It takes three to give birth!\n   0   0,1,2,4,5,6,7,8 -\u003e  0  # Barren\n```\n\nCells near or beyond the border are considered to be dead.\n  \n### Sources\n  \n- [Conway's game of life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)\n- [Rosetta Code Game of life](https://rosettacode.org/wiki/Conway%27s_Game_of_Life)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsylhare%2Fcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsylhare%2Fcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsylhare%2Fcpp/lists"}