Caesar Cipher class program in C++ using cstring library

0 Abdullah Karaman · February 18, 2015
Hey guys I need make a class named Caesar Cipher and also a program to encrypt and decrypt messages. I have to use cstring  library. I have 1 private member variable and 3 member functions. Anyone could help me?

Here is the code

#include 
#include
using namespace std;

class CaesarCipher
{
private:
    int shift;
public:
    CaesarCipher(int size);
    void encrypt(char letters[]);
    void decrypt(char letters[]);    
    
};

int main(){



    return 0;
}
//================================================
CaesarCipher::CaesarCipher(int size)
{
    shift = size;
}
//================================================
void CaesarCipher::encrypt(char letters[])
{
    for(int i = 0; i < shift; i++)
            letters[i] += shift;
    // apply the shift
    // Loop over each char in the array letters
        // char += shift;
}
//================================================
void CaesarCipher::decrypt(char letters[])
{
}


Post a Reply

Replies

Oldest  Newest  Rating
+1 Mathias Frits Rørvik · February 18, 2015
What exactly do you need help with?
0 Abdullah Karaman · February 18, 2015
The implementation of encrypt and decrypt. Sorry, I didn't specify
0 Abdullah Karaman · February 18, 2015
I want to know how can I loop through each character and shift the alphabet.
  • 1

C++

107,324 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator