当前位置:网站首页>Check password
Check password
2022-07-02 14:30:00 【Name it as father】
One 、 Title Description
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 .
Two 、 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 .
3、 ... and 、 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..
Four 、 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.
5、 ... and 、 Code demonstration
#include<stdio.h>
#include<string.h>
int main()
{
int n;
scanf("%d", &n);// Output n
getchar();
char a[81];
int len;
while (n--)
{
int cha = 0, num = 0, point = 0, other = 0;
gets(a);
len = strlen(a);
if (len < 6) {
printf("Your password is tai duan le.\n");
continue;
}
else for (int i = 0; i < len; i++)
{
if (a[i] >= '0' && a[i] <= '9')num++;
else if (a[i] >= 'a' && a[i] <= 'z' || a[i] >= 'A' && a[i] <= 'Z')cha++;
else if (a[i] == '.')point++;
else other++;
}
if (other != 0)printf("Your password is tai luan le.\n");
else if (cha != 0 && num == 0)printf("Your password needs shu zi.\n");
else if (cha == 0 && num != 0)printf("Your password needs zi mu.\n");
else printf("Your password is wan mei.\n");
}
return 0;
}边栏推荐
- [deep learning] simple implementation of neural network forward propagation
- Thymeleaf dependency
- go操作redis
- 博睿数据一体化智能可观测平台入选中国信通院2022年“云原生产品名录”
- C crystal report printing
- Stm32-dac Experiment & high frequency DAC output test
- 自定义事件,全局事件总线,消息订阅与发布,$nextTick
- Talk about idempotent design
- Pychart connects to the remote server
- OpenHarmony笔记-----------(四)
猜你喜欢

2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect

< schéma de développement de la machine d'exercice oral > machine d'exercice oral / trésor d'exercice oral / trésor de mathématiques pour enfants / lecteur LCD de calculatrice pour enfants IC - vk1621

Uniapp automated test learning

Borui data integrated intelligent observable platform was selected into the "Yunyuan production catalogue" of China Academy of communications in 2022

Teamtalk source code analysis win client

TeamTalk源码分析之win-client

<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持

Qt新建项目

什么是 eRDMA?丨科普漫画图解

kaggle如何使用utility script
随机推荐
Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
Data consistency between redis and database
2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
Multi rotor aircraft control using PID and LQR controllers
Codeforces Round #803 (Div. 2)(A~D)
给Android程序员的一些面试建议「建议收藏」
Basic knowledge of QT original code
一般来讲,如果频繁出现inconsistent tab and space的报错
Custom events, global event bus, message subscription and publishing, $nexttick
NLA natural language analysis makes data analysis more intelligent
联合搜索:搜索中的所有需求
Fabric. JS free drawing ellipse
How kaggle uses utility script
c# 水晶报表打印
每日学习2
Some interview suggestions for Android programmers "suggestions collection"
4、数组指针和指针数组
The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
NLA自然语言分析实现数据分析零门槛
Launcher startup process