// THIS IS C CODE SO YOU HAVE TO INSTALL TURBO C OR DEV C++ IN YOUR SYSTEM, // YOU CAN COPY THE CODE AND PASTE IN NOTEPAD OR ANY TEXT EDITOR THEN SAVE WITH " .c " ext. // OR DOWNLOAD THE GIVEN FILE AND COMPILE THAT FILE. CODE : : #include "stdio.h" #include "conio.h" #include "string.h" void main() { char ue[20]; char pe[20]; char sy[20]=""; int i; clrscr(); while(1) { printf("Enter username:"); scanf("%s",&ue); printf("Enter password:"); scanf("%s",&pe); for(i=0;i<strlen(pe);i++) { strcat(sy,"*"); } if( !(strcmp(ue,pe)) ) { printf("Username and password is correct\n"); printf("Welcome %s password is : %s ",ue,sy); break; } else { printf("Invalid username or password"); printf("\nEnter again\n"); } } getch(); } please Enter username and paswword same,, OUTPUT : :
Your comment will be posted after it is approved.
Leave a Reply. |