C++密码强度判断

默认分类 | 2020-02-07 03:14:46 | 阅读 338 次 | 评论(0)
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;
}

逃跑的蠕虫.png (上传于2020-02-07 03:14:46)
逃跑的蠕虫.png

C 农历.png (上传于2020-02-07 03:14:46)
C  农历.png

文章评论,共0条
游客请输入验证码