A comprehensive collection of C++ programming exercises covering fundamental and advanced concepts including object-oriented programming, recursion, data structures, and algorithmic problem-solving.
This repository contains a series of well-documented programming exercises designed to strengthen problem-solving skills and C++ proficiency. Each exercise includes:
- Clear problem descriptions
- Example test cases
- Expected outputs
- Complete source code implementations
| # | Exercise | Topic | Difficulty |
|---|---|---|---|
| 1 | Object-Oriented Programming & Inheritance | Classes, Inheritance, Polymorphism | Intermediate |
| 2 | Matrix Pattern Detection | Arrays, Matrices, Logic | Intermediate |
| 3 | Matrix Analysis | Linear Algebra, Statistics | Intermediate |
| 4 | String Processing | String Manipulation, Edge Cases | Intermediate |
| 5 | Continued Fractions | Recursion, Floating-Point Math | Advanced |
| 6 | Substring Extraction | String Processing, Pattern Matching | Beginner |
| 7 | Digit Collection & Sorting | Character Processing, Sorting | Beginner |
| 8 | Recursive Counting | Recursion, Array Processing | Intermediate |
| 9 | Matrix Transformation | Matrix Operations, Conditional Logic | Intermediate |
| 10 | Matrix Reshaping | Array Manipulation, Dimensions | Intermediate |
| 11 | Number Analysis | Number Theory, Most Significant Digit | Beginner |
| 12 | Recursive Digit Transformation | Recursion, Number Manipulation | Advanced |
- C++ Standard: C++11 or later
- Build System: CMake 3.10+
- Compiler: GCC 11+ or Clang 12+
- OS: Linux/WSL, macOS, or Windows (with appropriate tools)
Ensure you have the following installed:
# Ubuntu/Debian
sudo apt-get install build-essential cmake
# macOS (with Homebrew)
brew install cmake
# Windows (with MSVC or MinGW)
# Download from cmake.org and add to PATHgit clone https://github.com/todorx/VS-Code-Projects.git
cd VS-Code-Projects# Create build directory
mkdir build
cd build
# Configure and build
cmake ..
make
# Or use the preset (if available)
cmake --preset default
cmake --build --preset default- Open the project in VS Code
- Install the "CMake Tools" extension
- Select your preferred compiler kit
- Click "Build" in the status bar
After building, you can run individual exercises:
# Run all exercises
./VS-Code-Projects
# Or compile and run a specific OOP exercise
cd "OOP Exercises/Exercise-5"
g++ -std=c++11 exercise.cpp -o exercise5
./exercise5
# Or compile and run a specific structured exercise
cd structured-programming-exercises/Exercise-5
g++ -std=c++11 5.cpp -o exercise5
./exercise5VS-Code-Projects/
βββ CMakeLists.txt # Build configuration
βββ CMakePresets.json # CMake build presets
βββ README.md # This file
βββ .gitignore # Git ignore rules
βββ OOP Exercises/ # Object-Oriented Programming exercises
β βββ README.md
β βββ Exercise-1/ # OOP & Inheritance (Product/DiscountedProduct)
β β βββ main.cpp
β β βββ readme.md
β βββ Exercise-2/ # Song & CD Management
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-3/ # Ingredient & Dish Composition
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-4/ # Passenger & Train Management
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-5/ # List & ListContainer
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-6/ # Automobile & RentACar
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-7/ # Stopwatch (Operator Overloading)
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-8/ # NBAPlayer & AllStarPlayer (Inheritance)
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-9/ # Chocolate Factory (Operator Overloading)
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-10/ # Stock Record & Client Portfolio
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-11/ # Song & CD (from Vezbi Courses)
β β βββ exercise.cpp
β β βββ readme.md
β βββ Exercise-12/ # Train Management (from Vezbi Courses)
β βββ exercise.cpp
β βββ readme.md
βββ structured-programming-exercises/ # Procedural exercises
β βββ Exercise-2/ # Matrix Pattern Detection
β β βββ 2.cpp
β β βββ readme.md
β βββ Exercise-3/ # Matrix Analysis
β β βββ 3.cpp
β β βββ readme.md
β βββ Exercise-4/ # String Processing
β β βββ 4.cpp
β β βββ readme.md
β βββ Exercise-5/ # Continued Fractions
β β βββ 5.cpp
β β βββ 5-1.cpp
β β βββ readme.md
β βββ Exercise-6/ # Substring Extraction
β β βββ 6.cpp
β β βββ readme.md
β βββ Exercise-7/ # Digit Collection
β β βββ 7.cpp
β β βββ readme.md
β βββ Exercise-8/ # Recursive Counting
β β βββ 8.cpp
β β βββ readme.md
β βββ Exercise-9/ # Matrix Transformation
β β βββ 9.cpp
β β βββ readme.md
β βββ Exercise-10/ # Matrix Reshaping
β β βββ 10.cpp
β β βββ readme.md
β βββ Exercise-11/ # Number Analysis
β β βββ 11.cpp
β β βββ readme.md
β βββ Exercise-12/ # Recursive Digit Transformation
β βββ 12.cpp
β βββ readme.md
βββ out/ # Build output (ignored)
Start with these exercises if you're new to C++:
- Exercise 6: Basic string manipulation
- Exercise 7: Character processing and sorting
- Exercise 11: Number operations
Build on your fundamentals:
- Exercise 1: OOP and inheritance concepts
- Exercise 2: Matrix operations
- Exercise 3: Data analysis
- Exercise 4: String edge cases
- Exercise 9: Complex matrix transformations
Challenge yourself with:
- Exercise 5: Recursive mathematical computations
- Exercise 8: Advanced recursion patterns
- Exercise 10: Complex array manipulation
- Exercise 12: Recursive number theory
- Object-Oriented Programming: Classes, inheritance, polymorphism, virtual methods
- Recursion: Base cases, recursive calls, optimization
- Data Structures: Arrays, matrices, strings
- Algorithms: Sorting, pattern matching, mathematical computations
- String Processing: Parsing, substring extraction, character manipulation
- Matrix Operations: Transposition, transformation, analysis
- Number Theory: Digit manipulation, mathematical properties
- Problem Description: Clear statement of what needs to be implemented
- Input/Output Specifications: Format and constraints
- Example Test Cases: Multiple examples with expected outputs
- Difficulty Rating: Beginner, Intermediate, or Advanced
- Implementation: Complete, working C++ solution
All code follows these principles:
- Clean, readable naming conventions
- Comprehensive comments where needed
- Proper error handling
- Efficient algorithms
- Standard C++ practices
# Clean previous builds
rm -rf build/
# Rebuild from scratch
mkdir build && cd build && cmake .. && make- Ensure C++11 or later:
-std=c++11 -std=c++14 -std=c++17 - Check CMakeLists.txt configuration
- Verify all dependencies are installed
This project is provided for educational purposes.
Feel free to:
- Report issues or bugs
- Suggest improvements
- Submit optimized solutions
- Add additional test cases
Last Updated: May 7, 2026
For questions or feedback, feel free to open an issue or reach out!