Sunday, 3 December 2017

C# Program to Illustrate how User Authentication is Done


Code:

using System;
class program
{
    public static void Main()
    {
        char[] password = new char[10];
        char[] username = new char[10];
        char ch;
        int i;

        Console.WriteLine("Enter User name < 3 characters > : ");
        for (int x = 0; x < 8; x++)
        {
            username[x] = Convert.ToChar(Console.Read());
        }
        Console.WriteLine("Enter the password < any 8 characters>: ");
        for (i = 0; i < 8; i++)
        {
            ch = Convert.ToChar(Console.Read());
            password[i] = ch;
            ch = '*';
            Console.WriteLine("{0}", ch);
        }
        password[i] = '\0';
        Console.WriteLine("\n Your Password is :");
        for (i = 0; i < 8; i++)
        {
            Console.Write("{0}", password[i]);
        }
        Console.ReadLine();
        Console.ReadLine();
    }
}


Output:

Enter User name < 3 characters > :
s
r
i
Enter the password < any 8 characters>:
*
s
*
*
*
r
*
*
*
i
*
 Your Password is :
s
r
i



More C# Programs:




















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...