Just another try on the code base of the question ,
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
string pass;
string enc="akdhigfohre";
string x = "";
string y = "";
cout<<"Enter new password: ";
cin>>pass;
cout<<"\n\nYour New Password is:" << pass<<endl;
for(size_t i = 0; i < pass.size(); ++i){
x += pass.at(i)^enc.at(i%enc.size());
}
cout<<"\n\nEncrypted Version: "<<x;
for(size_t i = 0; i < x.size(); ++i){
y += x.at(i)^enc.at(i%enc.size());
}
cout<<"\n\nRecovred Password: "<<y;
system("pause");
}
solved Why my strings are not going to be XOR?