检查密码

题源

PTA 乙级

题解

#include<stdio.h>
int main(void)
{
	int i,j,N;
	int t_f1=0,t_f2=0,count=0;
	char key[81],c;
	scanf("%d",&N);getchar();
	for(i=1;i<=N;i++){
		for(j=1;c!='\n';j++){
			c=getchar();
			key[j]=c;
			count++;//printf("count=%d\n",count);
		}count--;//printf("count=%d\n",count);
		if(count<6){printf("Your password is tai duan le.\n");goto end;}
		for(j=1;j<=count;j++){
			if(('a'<=key[j]&&key[j]<='z')||('A'<=key[j]&&key[j]<='Z'))t_f1=1;
			else if('0'<=key[j]&&key[j]<='9')t_f2=1;
			else if(key[j]!='.'){printf("Your password is tai luan le.\n");goto end;}
		}
		if(t_f1==1){
			if(t_f2==1)printf("Your password is wan mei.\n");
			else printf("Your password needs shu zi.\n");
		}else{
			if(t_f2==1)printf("Your password needs zi mu.\n");
			else ;
		}
		end:count=0;c=-1;t_f1=0;t_f2=0;
	}
	return 0;
} 
posted @ 2020-11-24 13:30  summeriver13  阅读(30)  评论(0)    收藏  举报