题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805261217153024
题解:
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() { 5 int n; 6 cin >> n; 7 getchar(); 8 string str; 9 while (n--) { 10 getline(cin, str); 11 int s_num = 0, s_zimu = 0, s_dot = 0, s_blank=0, s_else = 0; 12 if (str.size() < 6) cout << "Your password is tai duan le." << endl; 13 else { 14 for (int i = 0; i < str.size(); i++) { 15 if ((str[i] >= ‘a‘&&str[i] <= ‘z‘) || (str[i] >= ‘A‘&&str[i] <= ‘Z‘)) 16 s_zimu++; 17 else if (str[i] >= ‘0‘&&str[i] <= ‘9‘) 18 s_num++; 19 else if (str[i] == ‘.‘) 20 s_dot++; 21 else 22 s_else++; 23 } 24 if (s_else != 0) cout << "Your password is tai luan le." << endl; 25 else { 26 if (s_zimu == 0) cout << "Your password needs zi mu." << endl; 27 else if (s_num == 0) cout << "Your password needs shu zi." << endl; 28 else cout << "Your password is wan mei." << endl; 29 } 30 } 31 } 32 return 0; 33 }
原文地址:https://www.cnblogs.com/Gzu_zb/p/9860812.html
时间: 2024-10-19 19:41:41