비밀번호 강도 검사기를 만들고 싶습니다. 비밀번호 입력란에 '비밀번호'를 입력하면 강도가 빨라집니다. 당신이 C++ Windows Form - If 문
녹색 나는 다음과 같은 경우 문을 사용하여 이런 짓을 한가는 다른 아무 것도 입력 :
try{
if (password_textbox_form3->Text == "password")
{
strength_color_textbox->BackColor = Color::Red;
}
else
{
strength_color_textbox->BackColor = Color::Green;
}
}
catch (Exception^)
{
strength_color_textbox->BackColor = Color::Black;
}
무엇 내가 지금 할 노력하고있어 어떤 난에 붙어있어, passwordscore라는 필드를 생성하는 방법입니다.이 필드는 ifstem 엔트 예를 들어 사용자가 입력 한 암호가 8 개 이상의 문자를 가지고, 다음이 점에서 나는 강도 상자의 색상을 (녹색 적색) 나는 시작했습니다
String^strength = password_textbox_form3->Text; //makes whatever the user enters in pw tb now called string
int passwordscore=0;
while // some sort of while loop to increment passwordscore? //passwordscore=passwordscore+1;
try{
if (strength //contains more than 8 characters)
{
//passwordscore +10
}
if (strength //contains a special character !"£$%^&*)
{
//password score +10
}
if (passwordscore <=10)
{
strength_color_textbox->BackColor = Color::Red;
}
if (passwordscore <=20)
{
strength_colour_textbox->BackColor = Color::Green;
}
그 방법을 변경할 수있는 경우 (10)를 추가 암호 텍스트 상자의 내용을 strength (나는)라고 불리는 문자열에 할당하고 힘이 8 자 이상인지를 보는 방법과 같은 IF 문에 붙어있다.
어떤 도움이나 지침이라도 고맙습니다. 감사합니다.
EDIT - 이걸 MSDN에서 찾았지만 C#으로 생각합니다. 뭘 하려구?
String^strength = password_textbox_form3->Text;
int numberOfDigits = 0;
int numberOfLetters = 0;
int numberOfSymbols = 0;
foreach (char c in strength)
{
if (char.IsDigit(c))
{
numberOfDigits++;
}
else if (char.IsLetter(c))
{
numberOfLetters++;
}
else if(char.IsSymbol(c))
{
numberOfSymbols++;
}
}
답장을 보내 주셔서 감사합니다. 지금 찾으십시오. – user2058186