[讨论]关于加密解密,用异或运算
编个程序,用户输入的一个字符加密后输出,当用户输入密码的时候将字符解密输出 ,不知道哪里出现问题了 ?
#include<iostream.h>
void main()
{
char a,b,c,d;
c=(a^b);
a=(c^b);
cout<<"please input the numbers you want to be secreted:"<<endl;
cin>>a;
cout<<"please input the password:"<<endl;
cin>>b;
cout<<c<<endl;
cout<<"if you want to get the number,please input the password:"
cin>>d;
if (c==d)
cout<<a<<endl;
else
cout<<"erro!please input the password again"
}