C Program to Illustrate how User Authentication is Done

C Program to Illustrate how User Authentication is Done.

  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5.  char password[10], username[10], ch;
  6.  int i;
  7.  
  8.  printf("Enter User name: ");
  9.  gets(username);
  10.  printf("Enter the password < any 8 characters>: ");
  11.  for (i = 0; i < 8; i++)
  12.  {
  13.             ch = getchar();
  14.             password[i] = ch;
  15.             ch = '*' ;
  16.             printf("%c", ch);
  17.  }
  18.         password[i] = '\0';
  19.  /*  Original password can be printed, if needed */
  20.  printf("\n Your password is :");
  21.  for (i = 0; i < 8; i++)
  22.  {
  23.             printf("%c", password[i]);
  24.  }
  25. }

 

Comments

Popular posts from this blog

C Program to Display the ATM Transaction

Java programming language

Python Program to Print all Prime Numbers in an Interval