#include<stdio.h> #include<conio.h> #include<string.h> void main() { char u[10],p[10],user[]="lokesh",pas[]="spiderman"; int n=0; clrscr(); printf("\n press enter and enter username and password(only 3 attempts)"); while(n<=2) { printf("\n Username: "); scanf("%s",&u); printf("\n Password: "); scanf("%s",&p); if(strcmp(user,u)==0 && strcmp(pas,p)==0) { printf("\n Congratulations!"); break; } else { n++; printf("\n the username or password is incorrect. only %d trials left. press enter", 3-n); } } if(n==3) { printf("\n you have used maximum attempts(3). please try later."); } getch(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)