小编Dav*_*ish的帖子

c ++识别字符串中的特殊字符

我正在为学校编写一个程序来检查密码的强度并将它们分成3个参数.我有一个问题,即识别强者中的特殊字符以对强者进行分类.任何帮助是极大的赞赏.

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string input;
    bool complete = false;
    bool hasUpper = false;
    bool hasLower = false;
    bool hasDigit = false;
    bool specialChar = false;
    int count;
    char special = 'a';


    do
    {
        cout << endl << "Enter a password to rate its strength. Enter q to quit." << endl;
        cin >> input;

        for(count =0; count < input.size(); count++)
        {
            if( islower(input[count]) )
            hasLower = true;

            if( isupper(input[count]) )
            hasUpper = true; …
Run Code Online (Sandbox Code Playgroud)

c++ string special-characters

2
推荐指数
1
解决办法
7174
查看次数

标签 统计

c++ ×1

special-characters ×1

string ×1