You are on page 1of 2

Worksheet-1.

1
AIM:- Write a code for Caesar Cipher.

CODE:-

#include <iostream>

using namespace std;

int main()

int i;

char str[100];

cout << "Please enter a string:\t";

cin >> str;

for(i = 0; (i < 100 && str[i] != '\0'); i++)

str[i] = str[i] + 3;

cout << "\nEncrypted string: " << str << endl;

for(i = 0; (i < 100 && str[i] != '\0'); i++)

str[i] = str[i] - 3;

cout << "\nDecrypted string: " << str << endl;

return 0;

}
OUTPUT:-

LEARNING OUTCOMES:-

 Learnt to code for Caesar Cipher.


 Caesar Cipher technique is the simple and easy method of encryption
technique.
 It is simple type of substitution cipher.
 Each letter of plain text is replaced by a letter with some fixed number of
positions down with alphabet.

You might also like