Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string SzyfrJ(int a, string text) {
- string ret = "";
- for (int i = 0; i < text.length(); i++) {
- char b = tolower(text[i]);
- if (b != 32) {
- if (b + a > 122) {
- ret += 97 - (122 - (b + a));
- }
- else {
- ret += (b + a);
- }
- }
- else {
- ret += ' ';
- }
- }
- return ret;
- }
- string Szyfr357(string text) {
- int szyfr = 0;
- int liczby[] = { 3,5,7 };
- for (int i = 0; i < text.length(); i++) {
- text[i] += liczby[szyfr];
- szyfr++;
- if (szyfr > 2)
- szyfr = 0;
- }
- return text;
- }
- string DeSzyfr357(string text) {
- int szyfr = 0;
- int liczby[] = { 3,5,7 };
- for (int i = 0; i < text.length(); i++) {
- text[i] -= liczby[szyfr];
- szyfr++;
- if (szyfr > 2)
- szyfr = 0;
- }
- return text;
- }
- string SzyfrKlucz(string szyfr, string text) {
- int a = 0;
- for (int i = 0; i < text.length(); i++) {
- int d = 0;
- stringstream ss;
- ss << szyfr[a];
- ss >> d;
- text[i] += d;
- a++;
- if (a > szyfr.length()-1)
- a = 0;
- }
- return text;
- }
- string DeSzyfrKlucz(string szyfr, string text) {
- int a = 0;
- for (int i = 0; i < text.length(); i++) {
- int d = 0;
- stringstream ss;
- ss << szyfr[a];
- ss >> d;
- text[i] -= d;
- a++;
- if (a > szyfr.length() - 1)
- a = 0;
- }
- return text;
- }
Advertisement
Add Comment
Please, Sign In to add comment