User authentication in C

by Nideesh C on April 12, 2011 · 0 comments

in C Programming




/* This program is to illustrate how user authentication is made before allowing the user to access the secured resources. It asks for the user name and then the password. The password that you enter will not be displayed, instead that character is replaced by ‘*’  */

#include <stdio.h>
#include <conio.h>

void main()
{
char pasword[10],usrname[10], ch;
int i;

clrscr();

printf(“Enter User name: “);
gets(usrname);
printf(“Enter the password <any 8 characters>: “);

for(i=0;i<8;i++)
{
ch = getch();
pasword[i] = ch;
ch = ‘*’ ;
printf(“%c”,ch);
}

pasword[i] = ‘\0′;

/*If you want to know what you have entered as password, you can print it*/
printf(“\nYour password is :”);

for(i=0;i<8;i++)
{
printf(“%c”,pasword[i]);
}
}

/*———————————————–
Output
Enter User name: Latha
Enter the password <any 8 characters>: ********
Your password is :Wipro123
———————————————–*/

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to find the value of sin(x) using the series up to the given accuracy (without using user defined function) Also print sin(x) using library function.
  2. C program to find the value of cos(x) using the series up to the given accuracy (without using user defined function) Also print cos(x) using library function.
  3. C program to read two integers M and N and to swap their values. Use a user-defined function for swapping. Output the values of M and N before and after swapping with suitable messages
  4. How can i Hide the Last User Logged On User
  5. How to Resolve “The User Profile Service failed the logon. User profile cannot be loaded” Problem

Leave a Comment

Previous post:

Next post: