9 Haziran 2015 Salı

Caesar Cipher Solver - Sezar Şifresi Çözücü

This programme made with Visual Studio 2012 c++ console application .Firstly choose 0 for crypt or 1 for encrypt enter senteces  press enter and then enter key number (it means how many foward do you want ? ) I didn't add explain line if you need any help you can send me mail to enes065@gmail.com. I hope this article will be benefical for you.

Bu program Visual Studio 2012 c++ console application yapılmıştır. Şifreleme için 0 çözmek için 1 girip ardından metninizi giriniz.Anahtar rakamı girdikten sonra metniniz hazır.

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

char encrypt(char c,int key2)
{

if(isalpha(c)){
c=toupper(c);
c = (((c-65)-key2) % 26) + 65;
}

cout<<c;
return c;
}

char caesar(char c,int key)
{

if(isalpha(c)){
c=toupper(c);
c = (((c-65)+key) % 26) + 65;
}

cout<<c;
return c;
}


int _tmain(int argc, _TCHAR* argv[])
{
string text; int key; int a;
string text2; int key2; int a2;
string input;

cout<<"for crypt please enter 0, for encrypt please enter 1"<<endl;
cin>>a;
switch (a)
{
case 0:
    cout << "please enter the text" << endl;
    getline(cin, text);
getline(cin, text);
cout<<"Please enter key number"<<endl;
cin>>key;
for (int i = 0; i < text.length(); i++)
{
caesar(text[i],key);
} ; break;

case 1:
cout << "please enter the text" << endl;
    getline(cin, input);
getline(cin, text2);
cout<<"please enter key number"<<endl;
cin>>key2;

for (int i = 0; i < text2.length(); i++)
{
encrypt(text2[i],key2);
}; break;

    default:cout<<"Please Enter Value"<<endl;

}

cout<<endl;
system("pause");
return 0;
}


1 yorum:

  1. Lucky Club: Best Online Casino Site in the UK
    Our site is a free-to-play gambling site for everyone. Play online slots, jackpots, roulette, scratch cards, live casino, keno and 카지노사이트luckclub more. We also offer a 100%

    YanıtlaSil

Yorum yaptığınız için teşekkür ederiz.