fork(1) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. // Var
  7. std::string text = "string", encrypt, decrypt;
  8.  
  9. // Encryption
  10. for (int i = 0; i < text.length(); i++)
  11. {
  12. encrypt += text[i] ^ '1';
  13. }
  14.  
  15. // Decryption
  16. for (int i = 0; i < encrypt.length(); i++)
  17. {
  18. decrypt += encrypt[i] ^ '1';
  19. }
  20.  
  21. std::cout << "original text: " << text << std::endl << "encrypted text: " << encrypt << std::endl << "decrypted text: " << decrypt;
  22. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
original text: string
encrypted text: BECX_V
decrypted text: string