当前位置:网站首页>检查密码
检查密码
2022-07-02 11:21:00 【名之以父】
一、题目描述
本题要求你帮助某网站的用户注册模块写一个密码合法性检查的小功能。该网站要求用户设置的密码必须由不少于6个字符组成,并且只能有英文字母、数字和小数点 .,还必须既有字母也有数字。
二、输入格式
输入第一行给出一个正整数 N(≤ 100),随后 N 行,每行给出一个用户设置的密码,为不超过 80 个字符的非空字符串,以回车结束。
注意: 题目保证不存在只有小数点的输入。
三、输出格式
对每个用户的密码,在一行中输出系统反馈信息,分以下5种:
- 如果密码合法,输出
Your password is wan mei.; - 如果密码太短,不论合法与否,都输出
Your password is tai duan le.; - 如果密码长度合法,但存在不合法字符,则输出
Your password is tai luan le.; - 如果密码长度合法,但只有字母没有数字,则输出
Your password needs shu zi.; - 如果密码长度合法,但只有数字没有字母,则输出
Your password needs zi mu.。
四、输入样例
5
123s
zheshi.wodepw
1234.5678
WanMei23333
pass*word.6
输出样例
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.
五、代码演示
#include<stdio.h>
#include<string.h>
int main()
{
int n;
scanf("%d", &n);//输出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;
}边栏推荐
- Quick analysis: easy to share the Internet
- go操作redis
- Systemserver process
- NLA natural language analysis realizes zero threshold of data analysis
- MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
- Fabric. JS upper dash, middle dash (strikethrough), underline
- 【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
- [development environment] Dell computer system reinstallation (download Dell OS recovery tool | use Dell OS recovery tool to make USB flash disk system | install system)
- <口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
- NLA自然语言分析实现数据分析零门槛
猜你喜欢

万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单

Teamtalk source code analysis win client

Fabric. Usage of JS eraser (including recovery function)

Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred

Yyds dry goods inventory software encryption lock function

Fabric. JS free draw circle

Certik released the defi security report in 2021, disclosing key data of industry development (PDF download link attached)

千元投影小明Q1 Pro和极米NEW Play谁更好?和哈趣K1比哪款配置更高?

Do you know that there is an upper limit on the size of Oracle data files?

提示:SQL Server 阻止了对组件‘Ad Hoc Distributed Queries ‘的STATEMENT ‘OpenRowset/OpenDatasource“”
随机推荐
Mysql5.7 installation super easy tutorial
How many knowledge points can a callable interface have?
MySQL 45 lecture - learning the actual battle of MySQL in Geek time 45 Lecture Notes - 05 | easy to understand index (Part 2)
Multi rotor aircraft control using PID and LQR controllers
[deep learning] simple implementation of neural network forward propagation
Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
Design of non main lamp: how to make intelligent lighting more "intelligent"?
测试框架TestNG的使用(二):testNG xml的使用
YOLOv3&YOLOv5输出结果说明
In 2021, the global styrene butadiene styrene (SBS) revenue was about $3722.7 million, and it is expected to reach $5679.6 million in 2028
MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
In 2021, the global TCB adapter revenue was about $93 million, and it is expected to reach $315.5 million in 2028
[to be continued] [UE4 notes] l5ue4 model import
字符串匹配问题
P1908 逆序对
NLA自然语言分析,让数据分析更智能
Quarkus学习四 - 项目开发到部署
C语言高级用法--函数指针:回调函数;转换表
Launcher startup process
Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?