Question
Write a program in C program and output For the file int2_1.txt is *AAAABBBccDEEEE* Does anyone still remember run-length encoding (RLE)? A set of data
Write a program in C program and output
For the file int2_1.txt is *AAAABBBccDEEEE*
Does anyone still remember run-length encoding (RLE)? A set of data string "AAAAbbbCCDEEEE" consists of 4 A, 3 b, 2 C, 1 D, and 4 E. The data can be encoded through RLE The compression is 4A3b2C1D4E (converted from 14 units to 10 units). Now I ask you to do it again, but this time the data to be entered is stored in the file. After the compression is completed, the result is written to out.txt. (25%)
Enter description:
Enter the file name. The file name should be less than 20 characters. It is assumed that the input is in.txt.
Read the data in in.txt. There is a string stored in in.txt. This string has only letters and ends at EOF (end of file). The length of the string is less than 10,000 characters.
Output description:
Write the compressed result in out.txt.
After writing, use the following code to output the contents of out.txt. (Copy and paste this paragraph to the end of your main function, before return 0)
Only the bottom line is the input, the rest are provided or are the results produced after the program is executed.
Example input:
in2_1.txt
Example in3_1.txt: (data stored in in2_1.txt)
AAAABBBccDEEEE
Example out.txt: (data stored in out.txt)
4A3B2c1D4E
Sample output: (Add the code provided above to print out the data stored in out.txt)
4A3B2c1D4E
2. run-length encoding (RLE), "AAAAbbbCCDEEEE", 4A3b2C1D4E, RLE4A3b2C1D4E1410, , , out.txt(25\%) : , 20, in.txt in.txt, in.txt, , EOF(), 10000 : out.txt out.txt(main, return 0 ) FILE *CHECK_FILE; char CheckCh; CHECK_FILE =fopen("out.txt","r"); while((CheckCh =getc(CHECK_FILE))!=EOF) putchar(CheckCh); fclose(CHECK_FILE); , : in2 1.txt in3_1.txt: (in2_1.txt) AAAABBBccDEEE out.txt: (out.txt) 4A3B2c1D4E FILE *CHECK_FILE; char CheckCh; CHECK_FILE =fopen("out.txt","r"); while((CheckCh =getc(CHECK_FILE))!=EOF) putchar(CheckCh); fclose(CHECK_FILE)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started