Skip to content

DilicalFlame/cpp-playground

Repository files navigation

CPP Playground

Image

This is my personal playground for C++ code snippets. It is not meant to be a complete project, but rather a collection of small examples and experiments to enhance my knowledge of c++ programming language.

Note: Notes on C++ programming language are available in the Resources folder.

Folder Structure

.
├── 100_The_Foundation/
│   ├── 110_Basic_IO_and_Syntax/
│   ├── 120_Control_Flow_and_Logic/
│   └── 130_Functions_and_Basic_Data_Aggregates/
├── 200_The_Core_Toolkit/
│   ├── 210_Pointers_Memory_and_Linear_Structures/
│   ├── 220_Abstract_Data_Types/
│   ├── 230_Foundational_Algorithms/
│   ├── 240_Non-Linear_Structures_Trees/
│   └── 250_Hashing_and_Graph_Structures/
├── 300_Modern_CPP_and_Design/
│   ├── 310_Resource_Management_and_RAII/
│   ├── 320_Object_Oriented_Programming_OOP/
│   ├── 330_Generic_Programming_with_Templates/
│   └── 340_Exploring_the_STL_and_Advanced_Features/
├── 400_Systems_Programming/
│   ├── 410_Low_Level_File_IO_and_Serialization/
│   ├── 420_Concurrency_and_Multithreading/
│   ├── 430_Networking_and_Protocols/
│   ├── 440_Inter_Process_Communication_IPC/
│   └── 450_Introduction_to_Embedded_Systems/
├── 500_Domain_Specializations/
│   ├── 510_Computer_Graphics/
│   ├── 520_Audio_Programming/
│   ├── 530_Cryptography/
│   └── 540_High_Performance_Computing_HPC/
├── 600_Grand_Challenges/
│   ├── 610_Building_a_Game_Engine/
│   ├── 620_Building_a_Database_Management_System/
│   ├── 630_Building_a_Compiler/
│   └── 640_Building_an_Operating_System_Kernel/
└── Resources/
    ├── Code_Snippets/
    ├── External_Articles_and_Docs/
    └── Language_Notes/

Contents

Contents is organized on the basis of deepest level of the folder structure.

110. Basic IO and Syntax

  1. Hello World - A simple program that prints "Hello, World!" to the console.
  2. Predefined Message - A program that prints a predefined message to the console.
  3. Input and Output - A program that takes user input and prints it to the console.
  4. Sum of Two Numbers - A program that takes two numbers as input and prints their sum.
  5. Temperature Conversion - A program that converts temperature between Celsius and Fahrenheit.
  6. Length Conversion - A program that converts lengths between Meters and Feet.
  7. Rectangle Area/Perimeter Calculator - A program that takes user input and outputs area and perimeter of rectangle.
  8. Floating Point Multiplier - Prompt the user for two floating point numbers and display product.
  9. Size of Data Types - Print the size in bytes of char, short, int, long, long long, float, double, and bool.
  10. Limits of Data Types - Print the limits of char, short, int, long, long long, float, double, and bool.
  11. ASCII - Print the ASCII value of a character.
  12. Simple Interest Calculator - Calculate simple interest given principal, rate, and time.
  13. Integer Overflow Demo - Demonstrates integer overflow in C++.
  14. Mixed Arithmetic Display - Perform and display results of arithmetic operations between integer and double.
  15. Swap Numbers - Swap two variables using temp variable

120. Control Flow and Logic

  1. Even/Odd Checker - Determine if number is even or odd
  2. Find Largest - Find largest of three numbers
  3. Vowel/Consonant - Check if character is vowel or consonant
  4. Leap Year - Check if year is leap year
  5. Basic Login - Username/password verification
  6. Number Guessing Game - Guess random number with hints
  7. Print 1 to N - Loop to print numbers 1 to N
  8. Multiplication Table - Generate multiplication table
  9. Factorial - Calculate factorial of number
  10. Prime Checker - Check if number is prime
  11. Palindrome Number - Check if number reads same forwards/backwards
  12. Fibonacci Generator - Generate Fibonacci sequence
  13. Calculator - Basic calculator using switch-case
  14. Rock Paper Scissors - Game against computer
  15. CGPA Calculator - Calculate grade point average
  16. Half Pyramid - Print star pattern in triangle shape
  17. Full Pyramid - Print full pyramid star pattern
  18. Armstrong Number - Check if number equals sum of digit powers
  19. Sum Natural Numbers - Sum numbers 1 to N
  20. Count Digits - Count digits in integer

130. Functions and Basic Data Aggregates

  1. Function (Pass-by-Value) - Demonstrate function scope
  2. Prime Function - Encapsulate prime checking in function
  3. Array Average - Calculate average of array elements
  4. Array Min/Max - Find smallest and largest in array
  5. Linear Search - Search for element in array
  6. Reverse Array - Reverse array elements in-place
  7. Count Duplicates - Count duplicate elements in array
  8. String to Uppercase - Convert C-string to uppercase
  9. String Trimmer - Truncate string to N characters
  10. Word Counter - Count words in C-string
  11. String Palindrome - Check if string is palindrome
  12. To-Do List - Manage tasks with array of strings
  13. Student Report Card - Use parallel arrays for student data
  14. Contact Book - Store names and phone numbers
  15. Bubble Sort - Sort array using bubble sort