vendredi 3 juillet 2020

Why when I type the input the code finishes? It should give me a random password (I'm still a beginner, if I've done something stupid don't hate me) [duplicate]

using System;
using System.Linq;

namespace RandomPassword
{
    class Program
    {
        private static void Main(string[] args)
        {
            char[] chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '%', '?', '*', '+', '_', '/', ';', '-', '&' };
            Random r = new Random();
            int character = r.Next(0, 72);
            Console.WriteLine("Random Password Generator\n");
            Console.WriteLine("How many characters do you want in your password?: ");
            int num_chars = Convert.ToInt32(Console.ReadLine());
            for (int a = 0; a == num_chars; a++)
            {
                Console.Write(chars[character]);
            }
        }
    }
}



Aucun commentaire:

Enregistrer un commentaire