{"id":22571234,"url":"https://github.com/ardacebi/cpp-examples","last_synced_at":"2025-10-24T05:05:15.963Z","repository":{"id":203911325,"uuid":"255089158","full_name":"ardacebi/cpp-examples","owner":"ardacebi","description":"Simple and basic C++ examples for educational purposes.","archived":false,"fork":false,"pushed_at":"2020-06-17T16:55:47.000Z","size":72,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T12:21:30.362Z","etag":null,"topics":["basic-example","cpp","cpp-examples","cpp-programming","educational","educational-materials","examples","examples-cpp","simple-example","simple-examples"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ardacebi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":"acebi","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-12T13:33:00.000Z","updated_at":"2023-01-11T23:27:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"31b2163f-0586-4613-af97-d7d027286e05","html_url":"https://github.com/ardacebi/cpp-examples","commit_stats":null,"previous_names":["ardacebi/cpp-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardacebi%2Fcpp-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardacebi%2Fcpp-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardacebi%2Fcpp-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardacebi%2Fcpp-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ardacebi","download_url":"https://codeload.github.com/ardacebi/cpp-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226026,"owners_count":21068112,"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":["basic-example","cpp","cpp-examples","cpp-programming","educational","educational-materials","examples","examples-cpp","simple-example","simple-examples"],"created_at":"2024-12-08T01:15:58.196Z","updated_at":"2025-10-24T05:05:10.934Z","avatar_url":"https://github.com/ardacebi.png","language":"C++","readme":"# C++ Examples\n\nSimple and basic C++ examples for educational purposes.\n\n## Index\n\n- [Building/Compiling](#building_compiling)\n- [Contributing](#contributing)\n- [Example Index](#example_index)\n\n## \u003ca name=\"building_compiling\"\u003e\u003c/a\u003eBuilding/Compiling\n\nYou can compile/build all these examples on your computer to change and try them out yourself.\n\n### Method 1: Using an IDE\n\nCompiling C++ projects using your IDE is an easy way of editing and seeing it's result in a shorter time.\n\n#### Visual Studio\n\nAfter you've loaded (and perhaps edited) the project to Visual Studio, build it from the Build section.\n\n\u003cimg src=\"https://lh3.googleusercontent.com/GYYWRP0Kajlph8HURMMCaqKu1UYEbkzeuEW0iw052TBa9Z5WgvZjkA5zpPJLLsDTXav-yeVKAGPTmQ=w3584-h1932-rw\"\u003e\u003c/img\u003e\n\n### Method 2: Terminal\n\nOf course, you can follow the traditional way of building C++ projects from the terminal.\n\n#### Linux\n\n1. Install GNU C/C++ compiler:\n\nIf you are using Fedora, Red Hat, CentOS, or Scientific Linux, use the following yum command to install GNU C/C++ compiler:\n\n`yum groupinstall 'Development Tools'`\n\nIf you are using Debian or Ubuntu Linux, type the following apt-get command to install GNU C/C++ compiler:\n\n`$ sudo apt-get update`\n\n`$ sudo apt-get install build-essential manpages-dev`\n\n2. `cd` to the directory in which the C++ project is located\n3. Compile with `g++ file.cpp -o file2`\n4. Run with `./file`\n\n#### Mac\n\n1. Compile with `g++ file.cpp`\n2. Run with `./file`\n\n#### Windows\n\n1. Download MinGW from [here](https://sourceforge.net/projects/mingw-w64/) or [here](https://sourceforge.net/projects/mingw/files/OldFiles/).\n2. `cd` to the directory in which the C++ project is located (like: cd C:\\Desktop\\...)\n3. Compile with `g++ file.cpp -o file.exe`\n4. Run the executable: `file.exe`.\n\n## \u003ca name=\"contributing\"\u003e\u003c/a\u003eContributing\n\nYou can contribute your examples with a pull request.\n\n1. Prepare your example with the necessary code and a comment that indicates you're author on the top (see existing examples).\n2. Fork the repository\n3. Add your example(s)\n4. Open a pull request.\n\nYour examples should be **instructive and explanatory with comments**. Make sure to explain important lines on your code (see existing examples). This is an important step as the main objective is to create an explanatory tutorial with all examples.\n\n## \u003ca name=\"example_index\"\u003e\u003c/a\u003eExample Index\n\n- [BMI Calculator](#bmi_calculator) [(file)](bmi.cpp)\n- [Hello World](#hello_world) [(file)](helloworld.cpp)\n- [Space Traveler](#space_traveler) [(file)](space.cpp)\n- [Temperature Converter](#temperature_converter) [(file)](temperature.cpp)\n\n---\n\n### \u003ca name=\"bmi_calculator\"\u003e\u003c/a\u003e[BMI Calculator](bmi.cpp)\n\nBody mass index (BMI) is a value derived from the mass and height of a person. The BMI is defined as the body mass divided by the square of the body height.\n\nThis program calculates the BMI of a person by:\n\n1. Asking them their height in metres (m)\n2. Asking them their weight in kilograms (kg)\n3. Calculating their BMI with the formula weight / (height \\* height).\n\n### \u003ca name=\"hello_world\"\u003e\u003c/a\u003e[Hello World](helloworld.cpp)\n\nThis is a basic Hello World program.\n\n### \u003ca name=\"space_traveler\"\u003e\u003c/a\u003e[Space Traveler](space.cpp)\n\nSomeone is travelling from Earth to six potential other planets in our solar system. This program requests the person's weight on Earth, and then calculates their weight on the other planets.\n\nThe program does this by:\n\n1. Asking the person their weight on Earth\n2. Asking the person which planet they want to travel\n3. After receiving those information, it multiplies the person's weight with the gravitational force of that planet to calculate their weight on those planets.\n\n### \u003ca name=\"temperature_converter\"\u003e\u003c/a\u003e[Temperature Converter](temperature.cpp)\n\nThis program converts Fahrenheit to Celsius and vice versa based on user selection.\n\nThe program does this by:\n\n1. Asking the user what they want to convert to and from (Fahrenheit to Celsius or Celsius to Fahrenheit)\n2. Asking the user to input the temperature value\n3. Outputting the final calculated value.\n","funding_links":["https://patreon.com/acebi"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardacebi%2Fcpp-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fardacebi%2Fcpp-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardacebi%2Fcpp-examples/lists"}