Okay, I really want to go through this whole thing and tear it apart so that you understand everything about it and the mistakes that're holding you back. I don't mean that to sound harsh, and I apologize if it does, I just mean to say that there are issues in this code that indicate that you're missing some vital information that prevents you from doing this correctly.
However, the biggest problem that I see is that, well... I don't think you really understand how XOR-based encryption works. So as a first step in helping, I'm going to give you the briefest of notes about this code and explain the most basic idea of XOR-based encryption. You can then look up additional information and figure out how to do it. If you still have trouble or you just want a more complete explanation, just ask(reply) and I'll happily put all my long-windedness behind a nice & long post explaining every aspect in as much detail as possible.
So, for the sake of sanity and an attempt at brevity...
XOR-based encryption is a byte-comparison. Bytes: C = A ^ B. Or, alternatively, bytes: A ^= B. To XOR an entire string with a key(as a std::string), you do have a few choices but a common method is: XOR each byte of the string with a single corresponding byte of the key.
do {
text[i] ^= key[i % key.size()];
} while (++i < text.size());
Now for other notes on the code...
First, start over. I'm sorry to say but the code you've written so far has grown in complexity such that the idea seems to be lost. It would be best to start it over and get the XOR encryption working first and then add file I/O. Multiple functions are nice but this whole process could be done in 30 lines or less including header declarations.
Next, you don't need to include so many different headers. Since it appears that you plan to do file I/O, <fstream> makes sense. However, you don't need the C library stuff so <cstdlib>, <cstddef>,<cstdio>(aka <stdio.h>), and <ctime> are not needed. As well, you don't need <bitset> and you probably don't need to use std::numeric_limits so <limits> is likely unnecessary. You're not using any vectors or maps so <vector> & <map> can be left out too. Also, drop the Windows-specific stuff as it's just a hindrance; no <windows.h> or <mmsystem.h>(not sure why you had that in there anyway). So you should only need the following:
#include <iostream> // for cin/cout/cerr streams & such
#include <string> // optional but recommended since you're using std::string
#include <fstream> // ifstream/ofstream
If you have other questions or, as I mentioned, want a more complete explanation of things then just ask. Good luck && have fun.