<sub class="descriptionSection">13-12-2024 09:03:am // #Tag // [[Link]]</sub> ____ ```cpp #include <iostream> #include <string> using namespace std; char charVerschluesseln(char c, int shiftFactor = 5){ if(shiftFactor <= 1 || shiftFactor > 24){ cout << "Ungültige Zahl, setze auf 5" << endl; shiftFactor = 5; } if(c+shiftFactor > 'Z' && c < 'a'){ cout << "Größer als Z" << endl; if(c == 'Z'){ c = 'A'+ shiftFactor; } c = 'A' + 'Z'- c; } else if(c+shiftFactor > 'z'){ cout << "Größer als z" << endl; if(c == 'z'){ c = 'a' + shiftFactor; } c = 'a' + 'z' - c; } else{ c = c+shiftFactor; } cout << "Neuer Char:" << c << endl; return c; }; int main(){ string input; cout << "String zum verschlüsseln eingeben: " << endl; std::getline(cin, input); string output; for(char c : input){ if(c == ' '){ output += ' '; continue; } output += charVerschluesseln(c); } cout << "Verschlüsselter String: " << output << endl; return 0; } ```