解题思路:使用数组标记,便于输出
注意事项:
参考代码:
#include<iostream> using namespace std; int main() { int k, r[50],sum=0; cin >> k; for (int z = 0; z < 50; z++) { r[z] = -1; } while (k--) { int lengh = 0, type = 0; int a = 0, b = 0, c = 0, d = 0; char s[100] = { '\0' }; cin >> s; for (lengh = 0; s[lengh] != '\0'; lengh++) { if (s[lengh] >= '0' && s[lengh] <= '9') a = 1; else if (s[lengh] >= 'a'&&s[lengh] <= 'z') b = 1; else if (s[lengh] >= 'A'&&s[lengh] <= 'Z') c = 1; else if (s[lengh] == '~' || s[lengh] == '!' || s[lengh] == '@' || s[lengh] == '#' || s[lengh] == '$' || s[lengh] == '%' || s[lengh] == '^') d = 1; } type = a + b + c + d; if (type >= 3 && (lengh >= 8)&&(lengh<=16)) r[sum++] = 1; else r[sum++] = 0; } for (int i = 0; i < 50; i++) { if (r[i] >= 0) { if (r[i] == 1) cout << "YES\n"; else cout << "NO\n"; } } return 0; }
0.0分
0 人评分
【计算两点间的距离】 (C语言代码)浏览:1522 |
1642题解浏览:784 |
大家好,我是验题君浏览:604 |
字符串输入输出函数 (C语言代码)浏览:2604 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:569 |
Tom数 (C语言代码)浏览:598 |
陶陶摘苹果2 (C语言代码)浏览:650 |
C语言程序设计教程(第三版)课后习题12.6 (C语言代码)浏览:732 |
C语言训练-自守数问题 (C语言代码)浏览:798 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:529 |