鱼C论坛

 找回密码
 立即注册
查看: 2148|回复: 4

代码中的问题

[复制链接]
发表于 2023-12-6 09:14:32 | 显示全部楼层
本帖最后由 jackz007 于 2023-12-6 09:19 编辑
  1. // 判断密码是否为强密码
  2. bool is_password_strong(string password) {
  3. . . . . . .
  4.     return has_digit && has_lower && has_upper && has_other;  // && has_other 画蛇添足了,只要去掉就好
复制代码

    就是说,把
  1.     return has_digit && has_lower && has_upper && has_other;
复制代码

    改为
  1.     return has_digit && has_lower && has_upper;
复制代码

    即可。
    至于原因嘛,因为你输入的密码 “ADAWDADA1231adadad” 中根本就没有 has_other 的成分存在,从而就干扰了函数的判断结果。
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-26 07:01

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表