Following up the partA and partB of this project, the code of project 1
need to implement operator overload and error handling. The header file has been slight modified
accordingly. The memory of private data string need to be dynamic allocated.
In part B, LCR has been introduced to encrypt the data string. In order to decrypt the data string,
modulus inverse method is often used. (refer to
[url removed, login to view] ). A simple method such as
extensive search can easily solve the inversion. For example: if when the encryption ‘f’ is
ciphered to ‘c’. During decryption, the code can simply scan from ‘a’ all the way to ‘space’ and
check which one can be encrypted to ‘c’ by using the same keys values.
The header file has been provide as below:
// File name: LCR_Ciper.h
// Description: Header file for LCR
// Date: 2/14/2017
using namespace std;
// overload operator<< to print context to console
friend ostream& operator<<(ostream& out, LCR_cipher& m);
// Constructor: allocate memory to save context and keys
LCR_cipher(char *context_string, char *keys_string);
// Copy constructor:
LCR_cipher(const LCR_cipher& other);
// Destructor: deallocate memory that was allocated dynamically
//check whether *keys string has valid LCR encryption value
//check whether the context string is encrypted or not
//Retrieve CLR encryption value from *keys string
void getkeys(int& a, int& c);
// output the *context to console
//using operator ++ to encrypt context string
//using operator -- to unencrypt context string
//Assignment operator overload
LCR_cipher& operator=(const LCR_cipher& other);
…… all the other operators…..
char *context; //array to store context string
char *keys; //array to store encryption keys
bool encrypted; //whether string in *context is encrypted or not
}; // End class
// End header file
For this project, you should overload the following night operators:
++ Using keys to encrypt the context
-- Using keys to decrypt the context
= For A=B, instance A will have same context and keys as instance B
< For A<B, instance A will get keys from instance B
+ If two instances have same keys values, the context of A and B can be concatenate
If two instances have same keys values, concatenate the context of A and B and assign
to a third instance
== Test if the unencrypted context of A and B are same or not
!= Test if the unencrypted context of A and B are different or not
<< Output the context to console
Exception handling: Your implementation should use try, throw, and catch to handle
exceptions. (See C++ Interlude 3 in the textbook.) At a minimum, your code should take care of
the following three cases:
1. Trying to create LCR_cipher object without valid context and keys, such as empty string.
2. If new returns NULL when allocating memory for data.
3. If the program attempts to add two instance with different keys.
File naming conventions: The name of your header (“specification”) file must be exactly
LCR_cipher.h, and the name of your source (“implementation”) file must be exactly
LCR_cipher.cpp. This latter file must contain your implementation of the ADT. Separate
client files will be posted in Canvas, for use in testing your code. These client files will have
names similar to [url removed, login to view], [url removed, login to view], etc., and each of these will contain a main()
6 freelancers están ofertando el promedio de $161 para este trabajo
Dear client, how are you? I am a C/C++ programmer and mathematician. Please check my "Profile & Work List" and contact with me if my skill is in your concern. Looking forward to your response. Thanks.
Hi,dear. Thank you for your interest. I have just checked your project report,I am able to perform this task with my developer team.I look forward to your proposal...
I, Jignesh Lakhani have completed [login to view URL] from IIT Roorkee. I am having very good knowledge of C, C++, Java and data structure. hope we will discuss more on it. thanks, Jignesh