#include "stdafx.h"
#include
#include
using namespace std;
int main() {
std::string sh = "abcdefghijklmnopqrstuvwxyz";
std::string text;
std::string result;
int k = 0;
int index = 0;
void enCode()
{
for (unsigned i = 0; i < text.length(); i++)
for (unsigned j = 0; j < 26; j++)
if (text == sh[j])
{
index = (3 * k + 4) % 26; //a=3 b=4
result += sh[index];
k = 0;
break;
}
else k++;
}
void deCode()
{
for (unsigned i = 0; i < text.length(); i++)
for (unsigned j = 0; j < 26; j++)
if (text == sh[j])
{
index = (9 * (k - 4)) % 26; //a=3 b=4
result += sh[index];
k = 0;
break;
}
else k++;
}
}
#include
#include
using namespace std;
int main() {
std::string sh = "abcdefghijklmnopqrstuvwxyz";
std::string text;
std::string result;
int k = 0;
int index = 0;
void enCode()
{
for (unsigned i = 0; i < text.length(); i++)
for (unsigned j = 0; j < 26; j++)
if (text == sh[j])
{
index = (3 * k + 4) % 26; //a=3 b=4
result += sh[index];
k = 0;
break;
}
else k++;
}
void deCode()
{
for (unsigned i = 0; i < text.length(); i++)
for (unsigned j = 0; j < 26; j++)
if (text == sh[j])
{
index = (9 * (k - 4)) % 26; //a=3 b=4
result += sh[index];
k = 0;
break;
}
else k++;
}
}