I was given the problem to write a class called block cipher to take in a text file and output the same text file after it has been encrypted. I have to use this header file...
#include <iostream>
using namespace std;
class block_cipher
{
public:
block_cipher(); // Constructor
void finish();
void output(char x);
private:
char c1;
char c2;
char c3;
short count;
void encrypt();
};
Here is my .cc file...
#include <iostream>
#include "block_cipher.h"
block_cipher::block_cipher()
{
}
void block_cipher::finish()
{
}
void block_cipher::output(char x)
{
c1 = x;
}
void block_cipher::encrypt()
{
char temp1;
temp1 = c1;
c1 = c2;
c2 = c3;
c3 = temp1;
}
I don't really understand how I can bring in one character at a time and save them as c1, c2, and c3 only using one parameter in output.