Tuesday, 13 May 2014

Username and Password in C Language

#include
#include
#include
void main()
{
clrscr();
_setcursortype(0);
char name[20];
char pass[20];
int a;


gotoxy(30,25);
textcolor(11);
cprintf("Enter Username : ");
textcolor(4);
gets(name);


if(((((((name[0]=='A')&&(name[1]=='a')&&(name[2]=='k')&&(name[3]=='a')&&(name[4]=='a')&&(name[5]=='s')&&(name[6]=='h')))))))
{
gotoxy(30,27);
textcolor(11);
cprintf("Enter yours password ");
textcolor(4);
cprintf("%c%c%c%c%c%c%c",2,2,2,2,2,2,2);
gotoxy(51,27);

for(a=0;a<=6;a++)
{
pass[a]=getch();
textcolor(1);
cprintf("%c",2);
}


if(((((((pass[0]=='A')&&(pass[1]=='a')&&(pass[2]=='k')&&(pass[3]=='a')&&(pass[4]=='a')&&(pass[5]=='s')&&(pass[6]=='h')))))))
{
sound(2000);
textcolor(2);
gotoxy(35,30);
cprintf("Access Granted !!!");
sleep(2);
nosound();
}
else
{
sound(2500);
textcolor(4+128);
gotoxy(35,30);
cprintf("Unvalid Password !!!");
sleep(2);
nosound();
}


}
else
{
sound(2500);
textcolor(4+128);
gotoxy(35,30);
cprintf("Unvalid Username !!!");
sleep(2);
nosound();
}





getch();
}

0 comments:

Post a Comment