zoukankan      html  css  js  c++  java
  • 1081 检查密码 (15 分)

    #include <iostream>
    #include <string>
    using namespace std;
    int main(){
        int n;
        string str;
        cin >> n;
        getchar();
        while (n--){
            int str_num = 0, str_letter = 0, str_dot = 0, str_other = 0;
            getline(cin, str);
            if (str.size() < 6)
                cout << "Your password is tai duan le." << endl;
            else{
                for (int i = 0; i < str.size(); i++){
                    if (str[i] >= '0' && str[i] <= '9')
                        str_num++;
                    else if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
                        str_letter++;
                    else if (str[i] == '.')
                        str_dot++;
                    else
                        str_other++;
                }
                if (str_other != 0)
                    cout << "Your password is tai luan le." << endl;  // 这个可以很巧妙的实现太乱了这个选项,一般都会卡在这儿
                else if (str_num == 0)
                    cout << "Your password needs shu zi." << endl;
                else if (str_letter == 0)
                    cout << "Your password needs zi mu." << endl;
                else
                    cout << "Your password is wan mei." << endl;
            }
        }
        return 0;
    }
  • 相关阅读:
    pm2
    php 基础知识
    EBADF, read
    php apache
    noah
    ejs
    node linux
    枚举系统进程
    c++ 进程权限的提升
    Liunx的目录结构
  • 原文地址:https://www.cnblogs.com/Hk456/p/10733454.html
Copyright © 2011-2022 走看看