Projects Inventory

Simulation of File Compression Algorithms Gaming Project in C++

Explanation

  1. Class Definition (RunLengthEncoder):
    • Public Methods:
      • compress(const std::string& input):
        • Compresses the input string using Run-Length Encoding (RLE).
        • Advertisement
        • Iterates through the string, counting consecutive occurrences of each character.
        • Constructs a compressed string in the format: character followed by the count.
        • Advertisement
        • Returns the compressed string.
      • decompress(const std::string& compressed):
        • Decompresses a string that was compressed using RLE.
        • Parses the compressed string to reconstruct the original string.
        • Returns the decompressed string.
  2. main Function:
    • Prompts the user to enter a string for compression.
    • Uses the RunLengthEncoder class to compress the input string and prints the result.
    • Advertisement
    • Then decompresses the compressed string to verify the accuracy and prints the decompressed string.
Exit mobile version