Đã hoàn thành

a C++ program that implements a few common operations that involve a simple cipher engine – primarily addition, keys_transfer, assignment and printing to the standard output.

Dự án này đã kết thúc thành công bởi wangbeizou với giá $90 USD trong 2 ngày.

Nhận tin báo giá cho dự án tương tự
Ngân sách dự án
$30 - $250 USD
Đã hoàn thành trong
2 ngày
Tổng đặt giá
Mô tả dự án

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


#include <iostream>

#include <iomanip>

#include <stdlib.h>

#include <fstream>

using namespace std;

class LCR_cipher


Spring 2017


// 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

bool iskeysOK();

//check whether the context string is encrypted or not

bool isencrypted();

//Retrieve CLR encryption value from *keys string

void getkeys(int& a, int& c);

// output the *context to console

void output_context();

//using operator ++ to encrypt context string

LCR_cipher& operator++();

//using operator -- to unencrypt context string

LCR_cipher& operator--();

//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()


Được hoàn thành bởi:
Các kỹ năng được yêu cầu

Muốn kiếm tiến?

  • Hạn định ngân sách và khung thời gian
  • Mô tả đề xuất của bạn
  • Nhận thanh toán cho công việc của bạn

Thuê những Freelancer đã đặt giá trong dự án này

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online