A structured collection of beginner-friendly C++ programs created to strengthen core programming concepts, problem-solving skills, and algorithmic thinking.
This repository serves as a personal learning workspace and contains practice exercises covering C++ basics, one-dimensional and two-dimensional arrays, functions, conversions, and console-based pattern printing.
- C++ syntax and console input/output
- Variables, operators, and expressions
- Conditional statements
- Loops and number-based exercises
- One-dimensional arrays
- Two-dimensional arrays and matrices
- User-defined functions
- Number-system conversions
- Temperature conversions
- Pattern-printing problems
- Basic algorithmic problem-solving
CPP-BASICS/
│
├── .vscode/
│ └── Visual Studio Code configuration files
│
├── arrays/
│ ├── 1D_Arrays/
│ │ └── One-dimensional array exercises
│ │
│ └── 2D_Arrays/
│ └── Matrix and two-dimensional array exercises
│
├── basics/
│ └── Beginner programs using input/output, conditions, loops,
│ arithmetic, and number-based logic
│
├── bin/
│ └── Compiled executable files
│
├── funtions/
│ └── conversion/
└──Function declarations, parameters, return values and conversion programs
│
├── patterns/
│ └── Star, square, triangle, pyramid, diamond, butterfly,
│ and number-pattern exercises
│
├── .gitignore
└── README.md
Contains exercises involving one-dimensional arrays, such as:
- Array input and output
- Finding the largest and smallest elements
- Counting positive, negative, odd, and even values
- Searching for elements
- Sorting arrays
- Reversing and rotating arrays
- Removing duplicate values
- Calculating sums and averages
Contains exercises involving matrices and two-dimensional arrays, such as:
- Matrix input and output
- Matrix addition and subtraction
- Matrix multiplication
- Matrix transpose
- Row and column operations
- Sum of matrix elements
Contains foundational C++ programs covering:
- Arithmetic operations
- Conditional statements
- Loops
- Number checks
- Prime numbers
- Factorials
- Palindromes
- Leap years
- Multiplication tables
- Character checks
- Eligibility-based programs
Contains conversion programs written with reusable functions:
BinaryToDecimal.cpp- Converts a binary number to decimalCelsiusToFahrenheit.cpp- Converts Celsius temperature to FahrenheitDecimalToBinary.cpp- Converts a decimal number to binary
Contains nested-loop exercises for printing:
- Squares and hollow squares
- Right-angled triangles
- Pyramids and inverted pyramids
- Diamonds and hollow diamonds
- Butterfly patterns
- Number-based patterns
Stores compiled executable files generated while testing programs locally.
Compiled files should normally remain excluded from Git through the
.gitignorefile.
The current funtions/conversion folder can be expanded gradually with the following subfolders:
funtions/
├── basics/
├── mathematics/
├── parameters/
├── overloading/
├── arrays/
├── strings/
├── recursion/
└── conversion/
Suggested programs include:
SimpleFunction.cppGreetingFunction.cppAddTwoNumbers.cppEvenOddFunction.cppMaximumOfTwo.cppMaximumOfThree.cppCalculatorUsingFunctions.cpp
FactorialFunction.cppPrimeNumberFunction.cppPowerFunction.cppGreatestCommonDivisor.cppLeastCommonMultiple.cppFibonacciFunction.cppSumOfDigitsFunction.cppReverseNumberFunction.cppPalindromeNumberFunction.cpp
PassByValue.cppPassByReference.cppSwapUsingReference.cppDefaultArguments.cppConstParameter.cpp
FunctionOverloading.cppAreaUsingOverloading.cppMaximumUsingOverloading.cpp
ArraySumFunction.cppArrayAverageFunction.cppArrayMaximumFunction.cppLinearSearchFunction.cppReverseArrayFunction.cppCountVowelsFunction.cppStringPalindromeFunction.cpp
RecursiveFactorial.cppRecursiveFibonacci.cppRecursivePower.cppRecursiveSum.cppRecursiveDigitSum.cppRecursiveReverseString.cpp
To compile and run these programs, install:
- A C++ compiler supporting C++17 or newer
- Visual Studio Code, CLion, Code::Blocks, or another C++ IDE
- Git for cloning and managing the repository
Recommended compiler:
g++ (MinGW-w64 on Windows)
Open a terminal in the repository and compile a program with:
g++ "path/to/program.cpp" -o bin/programExample:
g++ "funtions/conversion/BinaryToDecimal.cpp" -o bin/BinaryToDecimalRun the compiled program on Windows:
bin\BinaryToDecimal.exeRun it on Linux or macOS:
./bin/BinaryToDecimalThe main goals of this repository are to:
- Build a strong foundation in C++.
- Practise translating problems into working code.
- Improve logical and algorithmic thinking.
- Learn how functions improve code reuse and organisation.
- Maintain an organised record of learning progress.
- Prepare for object-oriented programming, data structures, and algorithms.
- Each source file focuses on a specific concept or exercise.
- Source files are organised by topic.
- Compiled executable files are stored inside the
binfolder. - New programs and folders will be added as learning progresses.
- Descriptive file names make exercises easier to locate.
This is primarily a personal learning repository. Suggestions, corrections, and improvements are welcome through issues or pull requests.
Asra