#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<string.h>
#define pixTOrc(x) (8*(x-1)) //convert pixel into row and col format//Advertise Screen will displayed to utilize empty screen area//It can be utilize for some effective...workvoid advertise(){
setcolor(BLUE);
outtextxy(pixTOrc(30),pixTOrc(26),"admin@syntaxexample.com");
setcolor(YELLOW);
}
//Function which shows loading...progress barvoid loading(){
//progressbar logicint i=1,j,cnt,clrflag=0;
setcolor(BLACK);
j=160;
cnt=5;
for(i=j;i<420;i++){
gotoxy(35,25);
cout<<cnt;
rectangle(j,375,i,405);
outtextxy(240,340,"LOADING ");
if(i==(j+10)){
j=j+13;
i=j;
if(clrflag==1){
clrflag=0;
setcolor(BLACK);
}
else{
clrflag=1;
setcolor(DARKGRAY);
}
cnt=cnt+5;
}
}
delay(500);
}
//At Exit the end function will call...void end(){
setfillstyle(LINE_FILL,DARKGRAY);
setcolor(YELLOW);
bar(pixTOrc(2),pixTOrc(10),pixTOrc(80),pixTOrc(55));
settextstyle(SMALL_FONT,HORIZ_DIR,7);
outtextxy(pixTOrc(5),pixTOrc(18),"Programmed by : Talented Programmer :))");
setcolor(LIGHTGREEN);
outtextxy(pixTOrc(5),pixTOrc(23),"Website : www.syntax-example.com");
outtextxy(pixTOrc(5.25),pixTOrc(23),"Website : www.syntax-example.com");
setcolor(LIGHTCYAN);
outtextxy(pixTOrc(5),pixTOrc(28),"Email : admin@syntaxexample.com");
outtextxy(pixTOrc(5.25),pixTOrc(28),"Email : admin@syntaxexample.com");
setcolor(LIGHTMAGENTA);
outtextxy(pixTOrc(5),pixTOrc(45),"Your Suggestion and comments are always welcome");
delay(2000);
}
//Function Displaying Password Screen...//I have kept validation that password should not//be greater than 6 letters...u can change it...#define MAX_LETTER 6
int get_password()
{
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(0,0,640,480);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(BLUE);
outtextxy(pixTOrc(8),pixTOrc(2)," Validate User");
setfillstyle(LINE_FILL,BROWN);
bar(pixTOrc(8),pixTOrc(7),pixTOrc(70),pixTOrc(7.5));
int i,j;
setfillstyle(LINE_FILL,DARKGRAY);
for(i=15,j=65;i<25||j>25;i++,j--){
bar(pixTOrc(15),pixTOrc(15),pixTOrc(i),pixTOrc(40));
delay(10);
bar(pixTOrc(j),pixTOrc(15),pixTOrc(65),pixTOrc(40));
sound(10+(i*250));
delay(10);
nosound();
}
int c=pixTOrc(40),a=-1;
//You can also make use of storing file containing//password...and than encrypt and decrypt for more//secured use...//Another thing...u can make the scree graphics//according to ur taste, i am giving u the most//simple view 4 tasting password.char pass[20],correctpassword[20]="syntax";
setcolor(YELLOW);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(pixTOrc(16),pixTOrc(17),"Enter password : ");
setcolor(LIGHTCYAN);
outtextxy(pixTOrc(16),pixTOrc(30),"Enjoy the Free version");
outtextxy(pixTOrc(16),pixTOrc(33),"Password is syntax");
setcolor(WHITE);
while (pass[a]!='\r')
{
pass[++a]=getche();
if (pass[a]=='\r' || a>=MAX_LETTER){
pass[a]='\0';
pass[++a]='\r';
break;
}
c+=15;
outtextxy(c,pixTOrc(17.5), "*");
}
if (strcmp(pass,correctpassword)==0){
outtextxy(pixTOrc(20),pixTOrc(24),"Password Accepted");
loading();
return(0);
}
else{
outtextxy(pixTOrc(20),pixTOrc(24),"Wrong Password!!!");
setcolor(WHITE);
getche();
return (1);
}
}
void main()
{
int i,j;
int gd=DETECT,gm=0;
initgraph(&gd,&gm,"");
int incorrect_pass=get_password();
if(incorrect_pass){
end();
goto quit;
}
///Code if password is correct\\\/* Must be written here *///example
setfillstyle(SOLID_FILL,BLACK);
bar(pixTOrc(2),pixTOrc(10),pixTOrc(80),pixTOrc(55));
settextstyle(SMALL_FONT,HORIZ_DIR,7);
setcolor(YELLOW);
outtextxy(pixTOrc(5),pixTOrc(18),"Password is Correct");
outtextxy(pixTOrc(5.25),pixTOrc(18),"Password is Correct");
outtextxy(pixTOrc(5),pixTOrc(25),"Programmed by : Talented Programmer");
outtextxy(pixTOrc(5.25),pixTOrc(25),"Programmed by : Talented Programmer");
setcolor(LIGHTGREEN);
outtextxy(pixTOrc(5),pixTOrc(28),"Website : www.syntax-example.com");
outtextxy(pixTOrc(5.25),pixTOrc(28),"Website : www.syntax-example.com");
setcolor(LIGHTCYAN);
outtextxy(pixTOrc(5),pixTOrc(31),"Email : admin@syntaxexample.com");
outtextxy(pixTOrc(5.25),pixTOrc(31),"Email : admin@syntaxexample.com");
getch();
outtextxy(pixTOrc(5),pixTOrc(40),"Have a nice Day");
outtextxy(pixTOrc(5.25),pixTOrc(40),"Have a nice Day");
delay(4000);
/////////////////////////////////
end();
quit:
closegraph();
}