This repository contains a curated collection of C++ programs and examples designed to help university students understand and master core C++ programming concepts. Each file demonstrates a specific topic, making it easier for peers to learn through practical, real-world code.
- Basic Syntax & Data Types
- Loops & Control Structures
- Arrays & Strings
- Functions & Function Overloading
- Object-Oriented Programming (OOP)
- Classes & Objects
- Constructors & Destructors
- Inheritance
- Polymorphism
- Abstract Classes & Virtual Functions
- Operator Overloading
- Structures
- File Handling
To compile and run any example:
- Open a terminal in the repository folder.
- Use a C++ compiler (e.g.,
g++,clang++, or MSVC) to compile the desired file:g++ filename.cpp -o output.exe ./output.exe
- Replace
filename.cppwith the file you want to run.
- C++ (Standard C++17/20)
- Compilers: GCC, Clang, MSVC
- Platform: Windows, Linux, macOS
Contributions are welcome! Peer students are encouraged to:
- Add new example programs covering additional concepts
- Improve code clarity or add comments
- Fix bugs or suggest enhancements
To contribute, fork the repository, create a branch, and submit a pull request with your changes.
| File/Filename | Description |
|---|---|
Abstract-class.cpp |
Demonstrates abstract classes and pure virtuals |
add-func_overload.cpp |
Function overloading example |
Add-Sub_distance-constructor.cpp |
Constructor usage with distance structures |
Add-Sub_time_constructor.cpp |
Constructor usage with time structures |
Adding_two_dates_STRs.cpp |
Adding two date structures |
adding-distnce-structures.cpp |
Structure operations: addition (distance) |
adding-time-structures.cpp |
Structure operations: addition (time) |
BinaryOperator_overloading.cpp |
Binary operator overloading |
class-date-RTOBJ.cpp |
Class example: date, returning objects |
classes-return-obj.cpp |
Classes returning objects from functions |
constructor_overload.cpp |
Constructor overloading |
Ex_2-inheritance.cpp |
Inheritance example |
Ex-1_function_overriding.cpp |
Function overriding example |
Ex-1_Inheritance.cpp |
Basic inheritance |
Ex-1_polymorphism.cpp |
Polymorphism example |
Ex-2_function_overriding.cpp |
Advanced function overriding |
Fun_overload.cpp |
Function overloading |
funtion_overriding.cpp |
Function overriding |
return-Tobj.cpp |
Returning objects from functions |
subtracting-date-structures.cpp |
Subtracting date structures |
subtracting-time-structures.cpp |
Subtracting time structures |
subtrcting-distance-structures.cpp |
Subtracting distance structures |
UnaryOperator_overload-.cpp |
Unary operator overloading |
unaryOperator_overload-PF.cpp |
Unary operator overloading (prefix/postfix) |
Virtual_function.cpp |
Virtual functions and runtime polymorphism |
This project is licensed under the MIT LICENSE.
I hope this effort will be a helpful favour for you.
Thanks for your cooperation.
Regards:
Author