#include
#include
#include "ctype.h"
void main()
{
unsigned i,n,j=0;
char str[20];
int lower,upper,digit,other,s;
printf("input how many array: ");
scanf("%d",&n);
while(j<=n)
{
lower=0,upper=0,digit=0,other=0;
j++;
printf("input:\n");
scanf(" %s",str);
if(strlen(str)<6)printf("Not Safe\n");
else
{
for(i=0;i{
if(islower(str[i])!=0) lower=1;//小写字母
else if(isupper(str[i])!=0) upper=1;//大写字母
else if(isdigit(str[i])!=0)digit=1;//数字
else other=1;
}
s=lower+upper+digit+other;
switch(s)
{
case 1:printf("Not Safe\n");break;
case 2:printf("Medium Safe\n");break;
case 3:
case 4:printf("Safe\n");
}
}
}
}
#include
int check(char *pwd)
{
char c,prevc=-1;
for(c=*pwd;c!='\0';c=*(++pwd))
{
if(!isalnum(c)||prevc==c)
return 0;
prevc=c;
}
return 1;
}
当参数只有数字和字母,并且没有两个连续相同字符时函数check返回1,否则返回 0