//To be compiled using VS 2013 #include #include #include #include #define MOVE_C 3 using namespace std; void ror(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 licz(string tekst) { int liczba = 0; for (int i = 0; i < tekst.size(); i++) if (tekst[i] == ' ') { liczba++; } return liczba; } int main() { string zaszyfrowane = ""; cout << "Podaj zaszyfrowany tekst: "; getline(cin, zaszyfrowane); int dlugosc = licz(zaszyfrowane) + 1; int* zasztab = new int[dlugosc]; char* _zasztab = new char[dlugosc]; istringstream ciecie(zaszyfrowane); for (int x = 0; x < dlugosc; x++) { ciecie >> zasztab[x]; } for (int i = 0; i < dlugosc; i++) { zasztab[i] = ~zasztab[i]; } ror(zasztab, dlugosc); for (int z = 0; z < dlugosc; z++) { _zasztab[z] = zasztab[z]; } cout << "Odszyfrowane: "; for (int j = 0; j < dlugosc; j++) { cout << _zasztab[j]; } _getch(); delete[] _zasztab; delete[] zasztab; return 0; }