专业商务报告制作与演示.pptVIP

  • 1
  • 0
  • 约1.39千字
  • 约 5页
  • 2017-02-14 发布于北京
  • 举报
专业商务报告制作与演示.ppt

课程首页 作业交流(PASSWORD) 许浛金 学号:130321030 题目要求 解题思路 代码分析 再优化? 我的困扰 我的困扰 结构混乱 题目要求 作业交流 我的困扰 结构混乱 问题描述 作业交流 密码是否合法 密码安全等级 ASCⅡ码比较 字符比较 减少循环 少耗内存 关键步骤 比较方式 优化思路 作业交流 结构混乱 #include iostream using namespace std; bool legalcheck(char* pszEnCode, int nLen) {if (nLen 6) return false; if (pszEnCode[0] = ‘a’ pszEnCode[0] = ‘z’) return true; if (pszEnCode[0] = ‘A’ pszEnCode[0] = ‘Z’) return true; return false;} int main() {char szPassword[266]= {0};cin szPassword; int nLen= strlen(szPassword); if (!legalcheck(szPassword, nLen)) {cout 0;return -1;} int nLevel= 0; for (int i=0; inLen; i++) {if (szPassword[i] = a szPassword[i] = z) {nLevel |= 0x1000;continue;} if (szPassword[i] = A szPassword[i] = Z) {nLevel |= 0x100;continue;} if (szPassword[i] = 0 szPassword[i] = 9) {nLevel |= 0x10;continue;} nLevel |= 0x1;} if (nLevel == 0x1111)cout 4; if (nLevel == 0x111 || nLevel == 0x1011 || nLevel == 0x1101 || nLevel == 0x1110) cout 3; if (nLevel == 0x1100 || nLevel == 0x1010 || nLevel == 0x1001 || nLevel == 0x110 || nLevel == 0x101 || nLevel == 0x11)cout 2; if (nLevel == 0x1000 || nLevel == 0x1000 || nLevel == 0x100 || nLevel == 0x10 || nLevel == 0x1) cout 1; return 0; } 核心代码 输入字符串 判断字符串长度是否合法 判断首字符是否合法 开始字符串循环 判断是否包含大写字符 判断是否包含小写字符 判断是否有数字 判断有三种字符外字符 判断密码级别 输出密码级别 结构混乱 作业交流 评测结果

文档评论(0)

1亿VIP精品文档

相关文档