Skip to content

Mohamed6seddiki/My_cpp_library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

A comprehensive C++ header library containing essential algorithms, mathematical functions, and utility operations commonly used in programming exercises and competitive programming.
๐Ÿ“‹ Features

Number Theory & Mathematics

Prime Number Detection - Efficient algorithm to check if a number is prime
Perfect Numbers - Find and validate perfect numbers (numbers equal to sum of their divisors)
Palindrome Numbers - Check if numbers read the same forwards and backwards
Digit Manipulation - Extract, reverse, sum, and analyze individual digits
Frequency Analysis - Count occurrences of specific digits in numbers

Pattern Generation

Number Patterns - Generate triangular number patterns (normal and inverted)
Letter Patterns - Create alphabetical triangular patterns (A, BB, CCC, etc.)
Password Generation - Generate random passwords and encryption keys
Word Generation - Generate all possible 3-letter combinations (AAA to ZZZ)

Cryptography & Security

Text Encryption/Decryption - Simple character-shift cipher implementation
Password Guessing - Brute force password cracking simulation
Random Key Generation - Generate formatted license keys (XXXX-XXXX-XXXX-XXXX)

Array Operations

Basic Operations - Fill, print, copy, and manipulate arrays
Statistical Functions - Calculate min, max, sum, and average of arrays
Filtering - Extract prime numbers, odd/even numbers, and distinct elements
Array Analysis - Check for palindrome arrays, count specific types of numbers
Sorting & Shuffling - Randomize array order and reverse arrays

Mathematical Utilities

Custom Math Functions - Implementations of abs, round, floor, ceil, and sqrt
Random Number Generation - Generate random numbers within specified ranges
Character Generation - Random character generation by type (letters, digits, symbols)

Input/Output Helpers

User Input Validation - Safe positive number input with validation
Formatted Output - Column separators and structured data display
Interactive Arrays - Dynamic array input from users

๐Ÿ“š Function Categories

๐Ÿ”ข Number Theory & Mathematics
| Subcategory | Functions | Description |
|-------------|-----------|-------------|
| Prime Numbers | CheckPrime(), CopyPrimeNumbers() | Check primality and filter prime numbers |
| Perfect Numbers | isPerfectNumber(), PrintPerfectNumbersFrom1ToN() | Find perfect numbers (sum of divisors = number) |
| Palindrome Check | IsPalindromeNumber(), IsPalindromeArray() | Check if numbers/arrays read same forwards/backwards |

๐Ÿงฎ Digit Manipulation
| Function | Purpose |
|----------|---------|
| PrintDigitsInReversedOrder() | Print digits in reverse order |
| SumOfDigits() | Calculate sum of all digits |
| ReverseNumber() | Reverse the entire number |
| CountDigitFrequency() | Count frequency of specific digit |
| PrintAllDigitsFrequencey() | Show frequency of all digits (0-9) |
| PrintDigits() | Print each digit separately |

๐ŸŽจ Pattern Generation
| Pattern Type | Functions |
|--------------|-----------| | Number Patterns | PrintNumberPattern(), PrintInvertedNumberPattern() |
| Letter Patterns | PrintLetterPattern(), PrintInvertedLetterPattern() |
| Word Generation | PrintWordsFromAAAtoZZZ() |

๐Ÿ” Security & Cryptography
| Feature | Functions | Usage |
|---------|-----------|-------|
| Text Encryption | EncryptText(), DecryptText() | Simple character-shift cipher |
| Password Tools | ReadPassword(), GuessPassword() | Password input and brute force simulation |
| Key Generation | GenerateWord(), GenerateKey(), GenerateKeys() | Generate random passwords and license keys |

๐ŸŽฒ Random Generation
| Type | Functions | Output |
|------|-----------|--------| | Numbers | RandomNumber() | Random integers in range |
| Characters | GetRandomCharacter() | Random chars by type (letter/digit/symbol) |
| Arrays | FillArrayWithRandomNumbers(), ShuffleArray() | Fill/shuffle arrays randomly |

๐Ÿ“Š Array Operations

Basic Operations
| Function | Purpose |
|----------|---------|
| ReadArray() | Input array from user |
| PrintArray() | Display array elements |
| FillArrayWith1toN() | Fill array with consecutive numbers |
| CopyArray() | Copy entire array |
| CopyArrayInReverseOrder() | Copy array in reverse order |

Analysis & Statistics
| Function | Returns |
|----------|---------|
| MaxNumberInArray() | Maximum value |
| MinNumberInArray() | Minimum value |
| SumArray() | Sum of all elements |
| ArrayAverage() | Average of elements |
| TimesRepeated() | Frequency of specific number |

Filtering & Searching
| Function | Purpose |
|----------|---------|
| CopyOnlyPrimeNumbers() | Extract only prime numbers |
| CopyOddNumbers() | Extr

๐Ÿš€ Usage

Simply include the header file in your C++ project:

#include "Header.h"

int main() {
// Example: Check if a number is prime
if (CheckPrime(17) == Prime)
{
cout << "17 is prime!" << endl;
}

//Example: Generate random keys
GenerateKeys(5);

//Example: Work with arrays
int arr[100];
int length = 0;
FillArrayWithRandomNumbers(arr, length);
PrintArray(arr, length);

return 0;
}

About

l have collected solutions to a set of problems in a library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages