c++ - 密码 While 循环
问题描述
我需要有关更改密码的帮助。这是项目的界面打开并重新打开时的部分。
int main()
{
Padlock Lock;
int D = 0;
int m = 1;
Lock.type_keycode();
do {
Lock.type_keycode1();
Lock.set_password(Lock.get_keycode());
Lock.set_userinput(Lock.get_keycode1());
Lock.Lockopen(Lock.get_password(), Lock.get_userinput());
cout << "TEST " << endl;
if (Lock.get_password() == Lock.get_userinput()) {
Lock.Lockoption(Lock.get_password(), Lock.get_userinput());
}
} while (Lock.get_keycode() != D);
return 0;
}
一旦 switch 语句打开,它就会执行这个命令。这是 switch 语句变量打开插槽并且您也希望它更改密码的部分。每次输出它都不会更改密码。
void Padlock::Lockoption(int password, int userinput)
{
int option;
int answer;
Padlock Lock;
do {
cout << "Choose your option: " << endl;
cout << endl
<< "0 - Reset Passwod. ";
cout << endl
<< "1 - Change Battery. ";
cout << endl
<< "2 - Return to Menu. ";
cout << endl
<< "3 - Defualt";
cout << endl
<< "4 - EXIT \n";
cout << "ENTER 0-4: " << endl;
cin >> option;
cout << endl;
switch (option) {
case 0:
cout << "Enter the three digits to reset Password: " << endl;
cin >> password;
Lock.set_password(password);
#Sets the password
Lock.get_password();
#password is encrypted
Lock.set_encrypted(password);
#Password is confirmed
Lock.get_encrypted();
#encrypted is confirmed
cout
<< endl;
cout << m << endl;
break;
当它被调试时,你输入新密码。但是,当您使用它时,它不起作用。
解决方案
推荐阅读
- javascript - JsExceptions 的本质是什么以及如何处理?
- sql-server - 两个日期之间的 SQL,其中日期用整数表示
- delphi - 当节点获得焦点时,哪个选项会影响 TVirtualStringTree 滚动到视图中?
- android - 如何将 Gradle 的外部依赖项存储在我的 Android Studio 项目的 SVN 中?
- javascript - javascript 创建一个数组
- function - 嵌套 IIF/查找
- java - 使用 Jackson CSV 将 CSV 解析为 POJO 列表
- react-native - 关于 react-native 中的图表
- r - 给定一个有限的调色板,如何从热到冷排序,即发散
- xpages - ViewScope 变量变为空,keepsessionalive 不起作用?