#include <iostream>
using namespace std;
int main()
{
char msg[] = "This is a test";
char key = 123;
cout << "Original message: " << msg << "\n";
for(int i = 0 ; i < strlen(msg); i++)
msg[i] = msg[i] ^ key;
cout << "Encoded message: " << msg << "\n";
for(int i = 0 ; i < strlen(msg); i++)
msg[i] = msg[i] ^ key;
cout << "Decoded message: " << msg << "\n";
return 0;
}
Original message: This is a test
Encoded message: /[[?[¤¤
Decoded message: This is a test