作者在 2020-02-07 03:14:46 发布以下内容
void 判断密码强弱()
{//缘由https://bbs.bccn.net/thread-499125-1-1.html
char aa[44]{""}; cout << "输入密码必须大于6位的字母数字符号组合:" << ends; cin >> aa;
int a = 0, b = 0, c = 0, j = 0;
while (aa[j] != '\0')
{
if (aa[j] >= '0'&&aa[j] <= '9')++a;
else if (aa[j] >= 'a'&&aa[j] <= 'z' || aa[j] >= 'A'&&aa[j] <= 'Z')++b;
else ++c; ++j;
}
if (a + b + c < 6)cout << "当前密码不合格" << endl;
if (a&&b&&c)cout << "强" << endl;
else if (a&&b || b&&c || c&&a)cout << "中" << endl;
else if (a || b || c)cout << "弱" << endl;
}