You're not calling getline
correctly. You're also trying to use string
as a variable when it's already defined as a type. I'd try something more like this:
getline(cin, mystr);
string result;
for (int i=0; i<10; i++) {
result.push_back(mystr[i] ^ key[i]);
cout << result[i];
}