我正在为学校编写一个程序来检查密码的强度并将它们分成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)