Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

346 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 CPP-BASICS

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.


📚 Topics Covered

  • 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

📂 Project Structure

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

🧩 Folder Overview

arrays/1D_Arrays

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

arrays/2D_Arrays

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

basics

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

funtions/conversion

Contains conversion programs written with reusable functions:

  • BinaryToDecimal.cpp - Converts a binary number to decimal
  • CelsiusToFahrenheit.cpp - Converts Celsius temperature to Fahrenheit
  • DecimalToBinary.cpp - Converts a decimal number to binary

patterns

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

bin

Stores compiled executable files generated while testing programs locally.

Compiled files should normally remain excluded from Git through the .gitignore file.


🗺️ Suggested Functions Roadmap

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:

Basic Functions

  • SimpleFunction.cpp
  • GreetingFunction.cpp
  • AddTwoNumbers.cpp
  • EvenOddFunction.cpp
  • MaximumOfTwo.cpp
  • MaximumOfThree.cpp
  • CalculatorUsingFunctions.cpp

Mathematical Functions

  • FactorialFunction.cpp
  • PrimeNumberFunction.cpp
  • PowerFunction.cpp
  • GreatestCommonDivisor.cpp
  • LeastCommonMultiple.cpp
  • FibonacciFunction.cpp
  • SumOfDigitsFunction.cpp
  • ReverseNumberFunction.cpp
  • PalindromeNumberFunction.cpp

Parameters and References

  • PassByValue.cpp
  • PassByReference.cpp
  • SwapUsingReference.cpp
  • DefaultArguments.cpp
  • ConstParameter.cpp

Function Overloading

  • FunctionOverloading.cpp
  • AreaUsingOverloading.cpp
  • MaximumUsingOverloading.cpp

Array and String Functions

  • ArraySumFunction.cpp
  • ArrayAverageFunction.cpp
  • ArrayMaximumFunction.cpp
  • LinearSearchFunction.cpp
  • ReverseArrayFunction.cpp
  • CountVowelsFunction.cpp
  • StringPalindromeFunction.cpp

Recursive Functions

  • RecursiveFactorial.cpp
  • RecursiveFibonacci.cpp
  • RecursivePower.cpp
  • RecursiveSum.cpp
  • RecursiveDigitSum.cpp
  • RecursiveReverseString.cpp

🛠️ Requirements

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)

▶️ Compile and Run

Open a terminal in the repository and compile a program with:

g++ "path/to/program.cpp" -o bin/program

Example:

g++ "funtions/conversion/BinaryToDecimal.cpp" -o bin/BinaryToDecimal

Run the compiled program on Windows:

bin\BinaryToDecimal.exe

Run it on Linux or macOS:

./bin/BinaryToDecimal

🎯 Purpose

The main goals of this repository are to:

  1. Build a strong foundation in C++.
  2. Practise translating problems into working code.
  3. Improve logical and algorithmic thinking.
  4. Learn how functions improve code reuse and organisation.
  5. Maintain an organised record of learning progress.
  6. Prepare for object-oriented programming, data structures, and algorithms.

📝 Notes

  • Each source file focuses on a specific concept or exercise.
  • Source files are organised by topic.
  • Compiled executable files are stored inside the bin folder.
  • New programs and folders will be added as learning progresses.
  • Descriptive file names make exercises easier to locate.

🤝 Contributions

This is primarily a personal learning repository. Suggestions, corrections, and improvements are welcome through issues or pull requests.


👤 Author

Asra

About

A collection of C++ programs covering foundational concepts, object-oriented programming, and practice exercises.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages