Users Online

· Guests Online: 142

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

43 C Program to Illustrate how User Authentication is Done

This C Program illustrate how user authentication is done. The program accepts the username and password. It checks whether the password is correct with respect to the username.
Here is source code of the C program to illustrate user authentication. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

/*
* 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[10], username[10], ch;
int i;

printf("Enter User name: ");
gets(username);
printf("Enter the password < any 8 characters>: ");
for (i = 0; i < 8; 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 < 8; i++)
{
printf("%c", password[i]);
}
}

$ cc pgm43.c
$ a.out
Enter User name: rajaraman
Enter the password : shashi12
********
Your password is :shashi12

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.76 seconds
10,817,046 unique visits