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;
		 }
		 
		 
			 
	
			
		}

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.

char symbol,symbols; 
string password;
for(int d=0; d < numericUpDown1->Value;++d) 
{
    symbol = rand() % 92 + 33; 
    /* ... */
    symbols = symbols + symbol ;
}
password = password + symbols;

Shouldn't symbols be a string ?

It looks like you want to concatentate stuff to it, but as written, the + operator changes its value instead, leaving it as a single character.

Thanks a lot thats sovled it here is code now. I will mark this as sovled. On ending is there away to save unicode char . I would like to add unicode char to program. I lose unicode changing system string to string.

for(int d=0; d < length ;++d) 
        {
			//generates random symbols 
 
loop:                symbol = rand() % 92 + 33; 
 
                if(symbol >= 48 && symbol <= 57) 
					goto loop; 
				
 
                if(symbol >= 65 && symbol <= 90) 
					goto loop; 
				
 
                if(symbol >= 97 && symbol <= 122) 
					goto loop; 
				
				
				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;
		 }
This question has already been answered. Start a new discussion instead.