Anther C program : Login
#include #include #include void main() { char userid[]="zion",password[]="zionatscodz",p[15],u[15]; int n=1,a,b; printf("\nEnter USER ID and PASSWORD below (You have only three chances to enter)"); getch(); while(n<=3) { clrscr(); printf("\nUSER ID: "); scanf("%s",u); printf("\nPASSWORD: "); scanf("%s",p); a=strcmp(u,userid); b=strcmp(p,password); if(a==0&&b==0) { printf("\nYou have logged in successfully."); break; } else { printf("\nWrong PASSWORD and/or USER ID. Now you have % d more chance/s.",3-n); } getch(); n++; } if(n==4) printf("\nYou can't log in."); getch(); }
In above program the USERID is "zion" & corresponding PASSWORD :"zionatscodz". If you able to enter it correctly. It will print "You have logged in successfully". If you fail to do so then it will print "You can't logged in". For more details check my profile :http://www.scodz.com/ViewProgram.php?link=920&uid=474
|
| Author: Jagadeesan. D 17 Dec 2007 | Member Level: Silver Points : 1 |
Good program
|
| Author: Arun Jadhav 17 Dec 2007 | Member Level: Diamond Points : 3 |
Hi Jagadeesan. D, Thank you for your complements. I have written various programs. Some of them are posted in the indiastudychannel resource section. For my other programs please visit my profile at http://www.scodz.com/ViewProfile.php?uid=474. Thanks and Regards Arun Jadhav
|