牛客网&&华为机试&&密码验证合格程序
代码实现
#include<iostream>
#include<string>
#include<cctype>
using std::cin;
using std::cout;
using std::endl;
using std::string;
bool JudgeTypenum(string str, int len)
{
bool digitflag = false;
bool upflag = false;
bool lowflag = false;
bool otherflag = false;
int result = 0;
for (int i = 0; i < len; ++i)
{
//if (digitflag == false && isdigit(str[i]) == true) err!!!
if (!digitflag && isdigit(str[i]))
{
digitflag = true;
result = result + 1;
}
else if (!upflag && isupper(str[i]))
{
upflag = true;
result = result + 1;
}
else if (!lowflag && islower(str[i]))
{
lowflag = true;
result = result + 1;
}
else if(!otherflag && !isspace(str[i]) )
{