Имеется такой генератор паролей. Но когда программа доходит до вывода количества полученных паролей, то они соединяются вместе. (Пример: программа сделала 2 пароля '123' и '321', но результат выходит, как '123321'). Как можно разделить эти пароли под каждую новую строку?
using System.Text;
public class Passgen
{
public static string GetRandomPassword(int length)
{
int amount = 0;
const string digits = "0123456789";
const string smalleng = "abcdefghijklmnopqrstuvwxyz";
const string capitaleng = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string smallrus = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
const string capitalrus = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
const string smalleng_smallrus = smalleng + smallrus;
const string capitaleng_capitalrus = capitaleng + capitalrus;
const string special = "!#$%&'()*+,-./:;<=>?@[\\]^_'{|}~ ";
Console.WriteLine("Выберите тип паролей: ");
Console.WriteLine("1) Цифры ");
Console.WriteLine("2) Анг + Рус алфавиты в нижнем регистре ");
Console.WriteLine("3) Анг алфавит в нижнем регистре ");
Console.WriteLine("4) Рус алфавит в нижнем регистре ");
Console.WriteLine("5) Анг + Рус алфавиты в верхнем регистре ");
Console.WriteLine("6) Анг алфавит в верхнем регистре ");
Console.WriteLine("7) Рус алфавит в верхнем регистре ");
Console.WriteLine("8) Специальные символы ");
int choice = Convert.ToInt32(Console.ReadLine());
Console.Write("Количество паролей = ");
amount = int.Parse(Console.ReadLine());
StringBuilder sb = new StringBuilder();
Random rnd = new Random();
if (choice == 1)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(digits.Length);
sb.Append(digits[index]);
}
}
}
if (choice == 2)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(smalleng_smallrus.Length);
sb.Append(smalleng_smallrus[index]);
}
}
}
if (choice == 3)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(smalleng.Length);
sb.Append(smalleng[index]);
}
}
}
if (choice == 4)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(smallrus.Length);
sb.Append(smallrus[index]);
}
}
}
if (choice == 5)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(capitaleng_capitalrus.Length);
sb.Append(capitaleng_capitalrus[index]);
}
}
}
if (choice == 6)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(capitaleng.Length);
sb.Append(capitaleng[index]);
}
}
}
if (choice == 7)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(capitalrus.Length);
sb.Append(capitalrus[index]);
}
}
}
if (choice == 8)
{
for (int i = 0; i < amount; i++)
{
for (int n = 0; n < length; n++)
{
int index = rnd.Next(special.Length);
sb.Append(special[index]);
}
}
}
return sb.ToString();
}
public static void Main()
{
begin: Console.Write("Длина паролей = ");
int length = Convert.ToInt32(Console.ReadLine());
if (length < 6) { Console.WriteLine("Длина паролей должна быть больше либо равна 6! Введите значение заново"); goto begin; }
string password = GetRandomPassword(length);
Console.WriteLine(password);
}
} ```