当前位置:网站首页>[untitled] PTA check password
[untitled] PTA check password
2022-06-25 14:50:00 【䨁 逦】
This topic requires you to help the user registration module of a website write a small function of password legitimacy check . The website requires that the password set by users must be no less than 6 Characters make up , And can only have English letters 、 Numbers and decimal points ., There must also be both letters and numbers .
Input format :
The first line of input gives a positive integer N(≤ 100), And then N That's ok , Each line gives a password set by the user , For no more than 80 A non empty string of characters , End with a carriage return .
Be careful : The title guarantees that there is no input with only decimal point .
Output format :
Password for each user , Output system feedback information in one line , Below 5 Kind of :
- If the password is legal , Output
Your password is wan mei.; - If the password is too short , Whether legal or not , All output
Your password is tai duan le.; - If the password length is legal , But there are illegal characters , The output
Your password is tai luan le.; - If the password length is legal , But only letters, no numbers , The output
Your password needs shu zi.; - If the password length is legal , But only numbers, no letters , The output
Your password needs zi mu..
sample input :
5
123s
zheshi.wodepw
1234.5678
WanMei23333
pass*word.6
sample output :
Your password is tai duan le.
Your password needs shu zi.
Your password needs zi mu.
Your password is wan mei.
Your password is tai luan le.No blank lines at the end
Code
#include<stdio.h>
#include<string.h>
int main()
{
char a[100][81];
int n=0,yingwen=0,shu=0,xiao=0,other=0;
scanf("%d",&n);
getchar();
for(int i=0;i<n;i++)
{
gets(a[i]);
}
for(int i=0;i<n;i++)
{ yingwen=0;shu=0;xiao=0;other=0;
for(int j=0;j<strlen(a[i]);j++)
{
if (strlen(a[i])<6)
{
printf("Your password is tai duan le.\n");
break;
}
if('0'<=a[i][j]&&a[i][j]<='9') shu++;
else if('A'<=a[i][j] && a[i][j]<='z') yingwen++;
else if(a[i][j]=='.') xiao++;
else other++;
}
if(strlen(a[i])>=6&&shu>0&&yingwen==0)
{
printf("Your password needs zi mu.\n");
}
else if(strlen(a[i])>=6&&yingwen>0&&shu==0){
printf("Your password needs shu zi.\n");
}
else if(strlen(a[i])>=6&&other>0)
{
printf("Your password is tai luan le.\n");
}
else if(strlen(a[i])>=6&&shu>0&&yingwen>0)
{printf("Your password is wan mei.\n"); }
}
}
边栏推荐
- C language LNK2019 unresolved external symbols_ Main error
- It's not easy to understand the data consistency of the microservice architecture for the first time after six years as a programmer
- 【中國海洋大學】考研初試複試資料分享
- Explanation of dev/mapper
- [Ocean University of China] information sharing for the first and second examinations of postgraduate entrance examination
- Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori
- 开餐馆
- 买基金在哪里开户安全?求指导
- Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment
- 分饼干问题
猜你喜欢

重磅!国产 IDE 发布,由阿里研发,完全开源!(高性能+高定制性)

To make pytorch faster, you need to master these 17 methods

China has made major breakthroughs in battery technology. Japan, South Korea and the United States are lagging behind. China has consolidated its leading edge

搭建极简GB28181 网守和网关服务器,建立AI推理和3d服务场景,然后开源代码(一)

90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟

【Try to Hack】vulnhub DC1

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat

Build a minimalist gb28181 gatekeeper and gateway server, establish AI reasoning and 3D service scenarios, and then open source code (I)

【中国海洋大学】考研初试复试资料分享

C language escape character and its meaning
随机推荐
Using Sphinx to automatically generate API documents from py source files
开餐馆
电源自动测试系统NSAT-8000,精准高速可靠的电源测试设备
Report on Hezhou air32f103cbt6 development board
[HBZ sharing] use of locksupport
JS get the height and width corresponding to the box model (window.getcomputedstyle, dom.getboundingclientrect)
The best time to buy and sell stocks
Vs2019 scanf error
[deep learning] multi task learning of multiple datasets data sets missing labels
API encapsulation of uniapp applet
Dmsetup command
JGG | 河北大学杜会龙组综述植物泛基因组学研究
dev/mapper的解释
Kubernetes understands kubectl/ debugging
Real variable instance
China has made major breakthroughs in battery technology. Japan, South Korea and the United States are lagging behind. China has consolidated its leading edge
【中國海洋大學】考研初試複試資料分享
One time summary: 64 common terms for data analysis!
Encapsulating functions and event handling
【Try to Hack】vulnhub DC1