in

C++ Program to break the Caesar Cipher

break the caesar cipher,infoclusters.com
Reading time: < 1 min
#include<iostream>
#include<string.h>
using namespace std;
int main(){
  string s;
  cout<<"Enter the Cipher text: ";
  cin>>s;
  int n = s.size();
  int k[n];
  for(int i=0;i<n;i++){
    k[i]=s[i];
  }
  int kept;
  for(int i=1;i<=26;i++){
    for(int m=0;m<n;m++){
      kept = k[m];
      kept = kept-i;
      cout<<char(kept);
    }
    cout<<endl;
  }	
return 0;
}

Note :

  • Don’t use space (” “) while giving input for the cipher text.
  • The output would be a list of 26 decrypted text. Find out the required plain text by looking at each text in one go.

Written by Vivek Kumar

Hello! I am Vivek Kumar, a Computer Science Engineer.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

Loading…

0
21 day lockdown in India, infoclusters.com

Let Observe the 21 day Lock-down

pm modi addressing nation, infoclusters.com

Extension of Lockdown in India to 3 May