1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>
#include<ctype.h>
#include<dos.h>
#include<graphics.h>
void graphic()
{ int Driver,Mode;
Driver=DETECT;
initgraph(&Driver,&Mode,"C:\\TC\\BGI");
}
void main()
{
char i,chr='y';
char Username[20];
char password[20];
int a=0,gr=0;
clrscr();
while(chr=='y')
{
cout<<" LOGIN DETAILS";
cout<<"\n\nUsername: ";
gets(Username);
cout<<"Password: ";
while((i=getch())!= 13)//ASCII code for ENTER
{if(i>32&&i<127)//ASCII codes for alphabets, numbers & symbols
{password[a] = i;
cout<<"*";
a++;
}
else if(i=='\b')//When backspace is encountered
{cout<<"\b \b";
a--;
}password[a]='\0';
}
if((strcmp(password,"admin\0")==0 && strcmp(Username,"ADMIN")==0))
{cout<<"\n\nACCESS GRANTED";
gr=1;
chr='n';
delay(350);
}
else
{cout<<"\nACCESS DENIED";
cout<<"\n\nDo you want to try again [y/n]: ";
cin>>chr;
clrscr();
password[a]='\0';
}
}
if(chr=='n'&& gr!=1)
{
cout<<"Thank You for using our Software";
cout<<"\nPress ENTER to EXIT...";
delay(600);
cout<<"\nExiting";
delay(600);
cout<<"...";
delay(600);
cout<<" ...";
delay(600);
cout<<" ...";
delay(955);
}
else if(chr!='y'&& chr!='n'&& gr!=1)
{cout<<"\nInvalid Entry";
cout<<"\nPress ENTER to EXIT...";
delay(600);
cout<<"\nExiting";
delay(600);
cout<<"...";
delay(600);
cout<<" ...";
delay(600);
cout<<" ...";
delay(955);
}
else if(gr==1)
{graphic();
setbkcolor(2);
settextstyle(10,0,3);
for(int i=0;i<350;i++)
{i+=2;
setcolor(i%5);
outtextxy(i-200,65,"WELCOME TO");
outtextxy(i-150,110,"CHJ PROJECT");
delay(50);
clrscr();
}
for(i=0;i<250;i++)
{i+=2;
setcolor(i%5);
outtextxy(150,65,"WELCOME TO");
outtextxy(200,110,"CHJ PROJECT");
delay(20);
clrscr();
}
closegraph();
clrscr();
cout<<"\nThe END";
getch();
}
}
|