Using C++, and <iostream> if possible,
Here is the code for you...
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
ifstream fin;
string fileName;
string output = "";
cout<<"Enter the name of the file to compress: ";
cin>>fileName;
fin.open(fileName);
int pos = fileName.find(".txt");
fileName = fileName.substr(0, pos);
fileName += "RLE.txt";
ofstream fout;
fout.open(fileName);
char previous, current;
int totalCharCount = 0;
fin>>previous;
totalCharCount++;
int count = 1;
//cout<<"The compressed text is:"<<endl;
while(!fin.eof())
{
fin>>noskipws>>current;
totalCharCount++;
if(fin.eof())
break;
if(tolower(current) == tolower(previous))
count++;
else
{
if(count == 1)
output += previous;
else
{
output += previous;
//output += ('0' + count);
output += to_string(count);
}
count = 1;
previous = current;
}
}
if(count == 1)
output += previous;
else
{
output += previous;
output += ('0' + count);
}
fout<<output<<endl;
}
Using C++, and <iostream> if possible, Write a program that can compress a text file...
PLEASE CODE IN PYTHON Run-length encoding is a simple compression scheme best used when a data-set consists primarily of numerous, long runs of repeated characters. For example, AAAAAAAAAA is a run of 10 A’s. We could encode this run using a notation like *A10, where the * is a special flag character that indicates a run, A is the symbol in the run, and 10 is the length of the run. As another example, the string KKKKKKKKKKKKKBCCDDDDDDDDDDDDDDDKKKKKMNUUUGGGGG would be encoded...
I need only one C++ function . It's C++ don't write any other language. Hello I need unzip function here is my zip function below. So I need the opposite function unzip. Instructions: The next tools you will build come in a pair, because one (zip) is a file compression tool, and the other (unzip) is a file decompression tool. The type of compression used here is a simple form of compression called run-length encoding (RLE). RLE is quite simple: when...
Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program is required that allows a user to encode text using any of three possible ciphers. The three ciphers you are to offer are: Caesar, Playfair and Columnar Transposition. • The program needs to loop, repeating to ask the user if they wish to play with Caesar, Playfair or Columnar Transposition until the user wishes to stop the program. •For encoding, the program needs to...
Do this using the C language. show me the code being executed and also copy and paste the code so i can try it out for myseld Instructions A cipher is mirrored algorithm that allow phrases or messages to be obfuscated (ie. "scrambled"). Ciphers were an early form of security used to send hidden messages from one party to another. The most famous and classic example of a cipher is the Caesar Cipher. This cypher worked by shifting each letter...
In C++ Having heard you have gotten really good at programming, your friend has come to ask for your help with a simple task. She would like you to implement a program to encrypt the messages she exchanges with her friends. The idea is very simple. Every letter of the alphabet will be substituted with some other letter according to a given key pattern like the one below. "abcdefghijklmnopqrstuvwxyz" "doxrhvauspntbcmqlfgwijezky" // key pattern For example, every 'a' will become a...
cs55(java) please Part 1: You are a programming intern at the student transfer counselor's office. Having heard you are taking CS 55, your boss has come to ask for your help with a task. Students often come to ask her whether their GPA is good enough to transfer to some college to study some major and she has to look up the GPA requirements for a school and its majors in a spreadsheet to answer their question. She would like...
okay so here is my c++ code and the errors im really stuck on fixing what i did wrong it seems to be the same repeated error our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses A your program should use a loop and your morse code printing...