Monday, July 2, 2018

C program to show how user authentication is done

    /*

     * C program is to illustrate how user authentication is done.

     * Program asks for the user name and password and displays

     * the password as '*' character

     */

    #include <stdio.h>



    void main()

    {

        char password[31], username[31], ch;

        int i;



        printf("Enter User name: ");

        gets(username);

        printf("Enter the password < any exact 30 characters>: ");

        for (i = 0; i < 31; i++)

        {

                ch = getchar();

                password[i] = ch;

                ch = '*' ;

                printf("%c", ch);

        }

            password[i] = '\0';

        /*  Original password can be printed, if needed */

        printf("\n Your password is :");

        for (i = 0; i < 31; i++)

        {

                printf("%c", password[i]);

        }

    }

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...