Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string encrypt(string text, string key)
- {
- //Ihre Loesung
- int x=text.length();
- int y=key.length();
- string result;
- int j=0;
- while (key.length()<text.length()) {
- key = key+key;
- }
- for (int i=0; i<x; i++) {
- result+=text[i]^key[j];
- j++;
- }
- return result;
- }
- /** Hier beginnt das Hauptprogramm */
- int main(int argc, char* argv[])
- {
- string text = "Dies ist irgendein Text.";
- string key = "abcdef";
- //Ihre Loesung
- cout << encrypt(text, key)<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement