Discussion: As noted in the c++ source file, the lines may start with many leading spaces. To save space in saving the file (to compress the file), the leading spaces of each line in the source file are counted and the count is stored as an integer at the beginning of the line followed by the rest of the characters of the line in the destination file.

Example:

Source file: source.txt
No leading space on line 1
_____Five leading spaces on line 2
______________Fourteen leading spaces on line 3
____Two leading spaces on line 4
0No leading space on line 1
5Five leading spaces on line 2
14Fourteen leading spaces on line 3
2Two leading spaces on line 4

1. Write a C++ program to compress a C++ source file, store the compressed file in source.zpp, and output to the monitor screen the number of space characters eliminated from the original source file.

2. Write a C++ program to uncompress the .zpp file previously compressed and store the uncompressed file in source.rcv.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.