1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
#include <string.h>
#include<locale.h>
using namespace std;
string encryption(string message,int a, int b)
{
char alfabe[29]={'A','B','C','Ç','D','E','F','G','Ğ','H','I','İ','J','K','L','M','N','O','Ö','P','R','S','Ş','T','U','Ü','V','Y','Z'};
string encryptedMessage= "";
for (unsigned x = 0; x < message.length(); x++)
{
encryptedMessage = encryptedMessage + alphabet[(((a * (message[x])) + b) % 29)];
}
return encryptedMessage;
}
int main()
{
setlocale(LC_ALL, "Turkish");
int a,b;
cout<<"Enter keyword a."<<endl;
cin>>a;
cout<<"Enter keyword b."<<endl;
cin>>b;
string text;
cout<<"Enter the text you want to encrypt"<<endl;
cin>>text;
cout<<encryption(text,a,b);
}
|