//To be compiled using VS 2013
#include <iostream>
#include <string>
#include <conio.h>
#ifndef MOVE_C
#define MOVE_C 3
#endif
using namespace std;
void rol(int tablica[], int wielkosc)
{
for (int i = 0; i < wielkosc; i++)
{
tablica[i] = (tablica[i] << MOVE_C) | (tablica[i] >> (sizeof(int) * CHAR_BIT - MOVE_C));
}
}
int main()
{
string kappa = "";
int dlugosc = 0;
cout << "Podaj tekst do zaszyfrowania: ";
getline(cin, kappa);
dlugosc = kappa.size();
int* asciitab = new int[dlugosc];
for (int i = 0; i < dlugosc; i++)
{
asciitab[i] = static_cast<int>(kappa[i]);
}
rol(asciitab, dlugosc);
for (int j = 0; j < dlugosc; j++)
{
asciitab[j] = ~asciitab[j];
}
cout << "Zaszyfrowana postac: ";
for (int k = 0; k < dlugosc; k++)
{
cout << asciitab[k] << " ";
}
_getch();
delete[] asciitab;
return 0;
}