using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; internal class Program { static Random rnd = new Random(); static string[] keeper; static void Main(string[] args) { Console.WriteLine("How many passowds u wanna generate?"); int count = int.Parse(Console.ReadLine()); Console.WriteLine("How LONG PASSWORD"); int length = int.Parse(Console.ReadLine()); Console.WriteLine("Upper? Y/N"); bool answer = Console.ReadLine().Trim().ToUpper() == "Y"; Console.WriteLine("Lower? Y/N"); bool answer2 = Console.ReadLine().Trim().ToUpper() == "Y"; Console.WriteLine("Numuri? Y/N"); bool answer3 = Console.ReadLine().Trim().ToUpper() == "Y"; Console.WriteLine("Special Characteres? Y/N"); bool answer4 = Console.ReadLine().Trim().ToUpper() == "Y"; if (!answer && !answer2 && !answer3 && !answer4) { Console.WriteLine("labi? 0_0"); } for (int i = 0;i < count; i++) { string koko = PasswordGenerator(answer,answer2,answer3,answer4, length); Console.WriteLine(koko); Console.ReadKey(); } } static string PasswordGenerator(bool answer, bool answer2, bool answer3, bool answer4, int length) { string obezjana = ""; string upperchar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string lowerchar = "abcdefghijklmnopqrstuvwxyz"; string numbers = "0123456789"; string specialchar = "!@#$%^&*()-_=+[]{}|;:,.<>?"; if (answer) { obezjana += upperchar; // += saja gadijuma strada ka ieklaut funkcija, ja atbilde ir tada, tad ieklauj tadu burtu tipu } if (answer2) { obezjana += lowerchar; // ta pat ari seit, 62, 66 rindas } if (answer3) { obezjana += numbers; } if (answer4) { obezjana += specialchar; } StringBuilder build = new StringBuilder(); // for (int i = 0; i < length; i++) { int popa = rnd.Next(obezjana.Length); // katra iteracija randomize izmantotos char build.Append(obezjana[popa]); // pievieno visus char vienam teikumam, ta sanak parole } return build.ToString(); } }