1081 检查密码 (15 分)
代码如下:
#include<cstdio>
#include<string.h>
using namespace std;
int main(){
int n;
cin>>n;
getchar();
string password;
while(n--)
{
getline(cin,password);
int len=password.length();
if(len<6){
printf("Your password is tai duan le.\n"); continue;
}
else
{
int flag=1;int num=0;int letter=0;int success=0;
for(int i=0;password[i]!='\0';i++)
{
if(password[i]>='0'&&password[i]<='9') num=1;
else if((password[i]>='A'&&password[i]<='Z')||(password[i]>='a'&&password[i]<='z')) letter=1;
else if(password[i]!='.'){
flag=0; break;
}
}
if(!flag)printf("Your password is tai luan le.\n");
else if(!letter){printf("Your password needs zi mu.\n");flag=0;}
else if(!num){printf("Your password needs shu zi.\n");flag=0;}
else if(flag==1)printf("Your password is wan mei.\n");
}
}
}