解题思路:
注意事项:
参考代码:
#include #include using namespace std; int main() { int q = 0; cin >> q; char a[1000]; for(int i=0;i<q;i++) { cin >> a; int l = strlen(a); int x = 0, y = 0, z = 0, o = 0, sum = 0; if (l >= 8 && l <= 16) { //统计字符类型 for (int i = 0; i < l; i++) { if (a[i] >= 'a' && a[i] <= 'z' ) { x = 1; } else if (a[i] >= 'A' && a[i] <= 'Z') { o = 1; } else if (a[i] >= '0' && a[i] <= '9') { y = 1; } else if (a[i]=='~'||a[i]=='!' || a[i] == '@' || a[i] == '#' || a[i] == '$' || a[i] == '%' || a[i] == '^') { z = 1; } //这里不能直接else,因为逗号字符不行 } sum = x + y + z+ o; if (sum == 3) { cout << "YES" << endl; } else { cout << "NO" << endl; } } else { cout << "NO" << endl; } } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:597 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:765 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:649 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:560 |
数组输出 (C语言代码)错误???浏览:596 |
淘淘的名单 (C语言代码)答案错误???浏览:614 |
WU-图形输出 (C++代码)浏览:831 |
简单的a+b (C语言代码)浏览:669 |
回文数字 (C语言代码)浏览:2532 |
模拟计算器 (C++代码)浏览:881 |