I am making a password genarator and having trouble with this part of code. I am trying to loop until length is meet but it only creates one char and I am trying to when it gets to certain char to skip and do nothing but loop until length is meet. I got upper, lower and numbers to work just having trouble with symbols.
if (checkBox4->Checked==true)
{
//generates random numbers
char symbol,symbols;
string password;
for(int d=0; d < numericUpDown1->Value;++d)
{
//generates random symbols
symbol = rand() % 92 + 33;
if(symbol >= 48 && symbol <= 57)
symbol = rand() % 92 + 33; // this is where i would like to do nothing skip these char
if(symbol >= 65 && symbol <= 90)
symbol = rand() % 92 + 33;
if(symbol >= 97 && symbol <= 122)
symbol = rand() % 92 + 33;
symbols = symbols + symbol ;
}
password = password + symbols;
for(int e=0; e<1000; e++)
{
//randomizes the password 1000 times
random_shuffle(password.begin(), password.end());
}
String^ out = gcnew String(password.c_str()); // Convert std::string to System String
textBox2->Text=out;
}
}