This repository contains a collection of programming assignments completed as part of a university C++ course. The projects demonstrate proficiency in C/C++ programming, data structures, object-oriented programming, and algorithm design.
This repository showcases implementations of various data structures and algorithms in C and C++, developed for academic coursework. Each assignment folder contains:
- Source code with comprehensive documentation
- Unit tests (where applicable)
- Build systems (Makefiles)
- Individual README files with assignment-specific details
- Languages: C, C++17
- Build System: GNU Make
- Testing: doctest (C++)
- Memory Analysis: Valgrind
- Compiler: GCC
Description: Implementation of a generic adaptive array data structure in C that dynamically resizes and supports polymorphic element types through function pointers.
Key Features:
- Dynamic memory management
- Generic element handling via function pointers (copy, delete, print)
- Automatic resizing on element insertion
- Memory-safe operations
Directory: Assignment-1/
Build:
cd Assignment-1
make
./demoStructure:
Assignment-1/
├── src/
│ ├── AdptArray.c/h # Core adaptive array implementation
│ ├── Person.c/h # Person data type example
│ └── book.c/h # Book data type example
├── tests/
│ └── Demo.c # Demonstration program
└── Makefile
Description: Object-oriented implementation of the card game "War" in C++, featuring player management, deck shuffling, and game logic.
Key Features:
- Card and Player classes with proper encapsulation
- STL containers for deck management
- Modern C++ features (move semantics, noexcept)
- Random deck shuffling using Mersenne Twister
Directory: Assignment-2/
Build:
cd Assignment-2
make
./demoDescription: A comprehensive C++ class for rational number arithmetic with operator overloading and proper mathematical operations.
Key Features:
- Fraction arithmetic (+, -, *, /)
- Comparison operators
- Automatic fraction reduction
- Type conversions and stream operators
Directory: Assignment-3/
Build:
cd Assignment-3
make testDescription: Strategy game implementation featuring inheritance, polymorphism, and object-oriented design patterns with different character types.
Key Features:
- Abstract Character base class
- Derived classes (Cowboy, Ninja variants)
- Team management and battle mechanics
- Polymorphic behavior
Directory: Assignment-4/
Build:
cd Assignment-4
make testDescription: Implementation and verification of magic squares with various algorithms.
Key Features:
- Magic square generation
- Validation algorithms
- Different construction methods
Directory: Assignment-5/
Build:
cd Assignment-5
make test- GCC compiler (supporting C11 and C++17)
- GNU Make
- Valgrind (optional, for memory leak detection)
Each assignment has its own Makefile. Navigate to the assignment directory and run:
# Build the project
make
# Run the demo
make run
# Run memory leak check (if available)
make mem_test
# Clean build artifacts
make clean# Clone the repository
git clone <repository-url>
cd CPP-Course
# Build and run Assignment 1
cd Assignment-1
make run
# Build and test Assignment 3
cd ../Assignment-3
make testCPP-Course/
├── .gitignore
├── README.md # This file
├── Assignment-1/ # Adaptive Array (C)
│ ├── src/ # Source files
│ ├── tests/ # Test/demo files
│ └── Makefile
├── Assignment-2/ # Card War Game (C++)
│ ├── sources/ # Source files
│ ├── Demo.cpp
│ └── Makefile
├── Assignment-3/ # Fraction Class (C++)
│ ├── sources/
│ ├── StudentTest1.cpp
│ ├── StudentTest2.cpp
│ └── Makefile
├── Assignment-4/ # Cowboy vs Ninja (C++)
│ ├── sources/
│ ├── StudentTest1.cpp
│ └── Makefile
└── Assignment-5/ # Magic Square (C++)
├── sources/
└── Makefile
- All assignments follow industry-standard coding practices
- Code includes comprehensive Doxygen-style documentation
- Memory management follows RAII principles where applicable
- Unit tests are provided for most assignments
This repository is provided for educational purposes and portfolio demonstration. If you are a student taking a similar course, please use this only as a reference and complete your own work independently.
Author: University Programming Course
Course: Advanced C++ Programming
Last Updated: 2025-11-26