jeudi 22 mars 2018

C# program which checks if the entered password is correct

I have to create a C# program which has to compare the inputted password with the password 954@. Three tries are allowed. If the user inputs wrong password 4 times in a row then a message has to appear "Access denied"

I tried something but I'm not really sure how to do it.

Here is my code:

     Console.WriteLine("Enter password: ");
        var input= int.Parse(Console.ReadLine());
        int pass = 954@;

        for (pass = 954@) 
        {
            Console.WriteLine("Correct password");
        }

        else
        {
            Console.WriteLine("Access denied");
        }

Aucun commentaire:

Enregistrer un commentaire