You are on page 1of 15

//HEADER FILES

# include<dos.h>
# include<math.h>
# include<process.h>
# include<graphics.h>
# include<iostream.h>
# include<conio.h>
# include<string.h>
# include<stdio.h>
# include<fstream.h>
# include<stdlib.h>
# include<ctype.h>
//ALL FUNCTIONS DEFINATIONS
void welcome_screen();
void op();
void re();
void menu(int,int,int,int,char*);
void choice(void);
void clr(void);
void screen();
void check(int i);
void stars();
//DECLARATIONS OF GLOBAL VARIABLES
int co=1,r=1,rec=7,start=12,old=1;;
char *pass,id3[20];
const tn=30;
int j,endd,hitcount,puzx,puzy,go_once=1,n=0;
int hang[26],mov[10],knotsu[1000],knotsme[1000],puzzle[10];
char s[79],key,knotc[10],c;
int end=' ',del=0;
int posknots[9][2]= {{160,160},
{210,160},
{260,160},
{160,210},
{210,210},
{260,210},
{160,260},
{210,260},
{260,260}};
//STRUCTURE FOR INBOX
struct inbox
{
char in[100],send[20],reci[20];
int ex;
};
//STRUCTURE FOR RETURN TYPE
struct rt
{
char id[20];
int z,w,op;
};
//STRUCTURE FOR SHIP
struct str

{
int posx,posy,ang,rad,image[200],speed;
} star[tn+1];
//DECLARATION OF STRUCTURE VARIABLE
rt rt1;
inbox i1;
//MAIN CLASS OF THE PROGRAMME
class pro
{
char id[20],pa[9],*sq,*sqa,ce[40],fn[20],ln[20],cr[20],g[1];
int pc,month,date,year;
public:
//DEFINATION OF FUNCTION IN PUBLIC
void style1();
void dat(void);
void wel1(void);
void initial (void);
void dis (void);
char* dis1(void);
void check(int);
int check2(int,int);
int help(void);
int check3(void);
void newuser();
void semail();
void remail();
};
//DECLARATION OF CLASS OBJECT
pro p,p1;
//DECLARATION OF FILE VARIABLES
ifstream f5;
fstream mp;
//DECLARATION OF ALL CLASS FUNCTIONS
void pro::style1()
{
clrscr();
int soun[15] = {304,484,578,345,232,145,678,565,345,678,343,264,354
,
786,344};
int i=0;
int driver,mode;
driver=DETECT;
initgraph(&driver,&mode,"\\tc\\bgi");
cleardevice();
while(!kbhit())
{
op();
setcolor(LIGHTRED);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 5);
outtextxy(100,90," Nimesh Kumar");
outtextxy(100,200,"
XII B-B");
outtextxy(100,300,"
Presents");

setcolor(15);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1);
outtextxy(70,390,"Press any key to continue...");
if(i>15)
i=0;
sound(soun[i]);
delay(150);
nosound();
i++;
}
getch();
cleardevice();
while(!kbhit())
{
setcolor(LIGHTRED);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 7);
outtextxy(70,90," e-Mailing");
outtextxy(70,190,"
Site");
setcolor(15);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 1);
outtextxy(70,390,"Press any key to continue...");
op();
if(i>15)
i=0;
sound(soun[i]);
delay(150);
nosound();
i++;
}
delay(500);
closegraph();
getch();
}
void welcome_screen()
{
int driver,mode;
driver = DETECT;
initgraph(&driver,&mode,"\\tc\\bgi");
int x;
//CIRCLES
for(x=1;x<100;x++)
{
{
sound((10*x)+1000);
delay(50);
nosound();
}
setcolor(x);
{
circle(x,x,x);
delay(15);
circle(625-x,x,x);
delay(15);
circle(x,450-x,x);
delay(15);
circle(625-x,450-x,x);
delay(15);
}

{
setcolor(14);
outtextxy(260,200,"============");
setcolor(10);
outtextxy(265,235," WELCOME !");
setcolor(14);
outtextxy(260,270,"============");
}
}
}
void pro::wel1(void)
{
clrscr();
textbackground(0);
clrscr();
int driver,mode;
driver = DETECT;
initgraph(&driver,&mode,"\\tc\\bgi");
int x;
int i,k,l,step,cho=1,ps=4,comp=2,comp1=2,ca,flag=12;
char ch,o1,o2,o3,o4;
randomize();
delay(10);
//set();
setbkcolor(BLACK);
clrscr();
do
{
closegraph();
//clrscr();
gotoxy(1,7);
switch (ch)
{
case 'P':{cho++;break;}
case 'H':{cho--;break;}
}
if (cho>3) cho=1;
if (cho<1) cho=3;
o1=o2=o3=' ';
if (cho==1) o1='-';
if (cho==2) o2='-';
if (cho==3) o3='-';
cout<<"
cout<<"
cout<<"
cout<<"
cout<<"

MENU "<<endl;
======"<<endl<<endl;
"<<endl;

"<<endl;
"<<o1<<" 1:OLD USER
"<<

cout<<"
cout<<"

"<<o2<<" 2:NEW USER

"<<endl;
"<<

cout<<"
cout<<"

"<<o3<<" 3:EXIT

"<<endl;
"<<

cout<<"
cout<<"

"<<endl;
"<<endl;

endl;
endl;
endl;

cout<<"

"<<endl;

ch=getch();
if (ch==0) ch=getch();
}
while ((ch!=13) && (ch!=27));
if (ch!=27)
{
if (cho==1)
{
cprintf("\nENTER LOGIN NAME:");
scanf("%20s",&id3);
for(ps=0;ps<rec;ps++)
{
comp=p1.check2(ps,1);
if(comp==0)
{
comp1=p1.check3();
if(comp1==0)
flag=0;
break;
}
else
flag++;
}
if(flag==0)
{
gotoxy(1,22);
cprintf("
");
gotoxy(1,22);
cprintf("WELCOME TO THIS SITE");
int soun[15] = {102,394,557,392,273,484,378,398,304,372,394,200,
257,
454,532};
int soun1[15] = {304,484,578,345,232,145,678,565,345,678,343,264
,354,
786,344};
for ( int il=0;il<15; il++)
{
sound(soun[il]);
delay(100);
nosound();
sound(soun1[il]);
delay(150);
nosound();
}
start=0;
}
else
{
cprintf("ACCESS DENIED");
start=13;
getch();
}
clrscr();
}
if (cho==2)

{
newuser();
}
if (cho==3)
{
exit(2);
}
}
}
int pro::check2(int ps,int z)
{
//z=0 for call by initial
//z=1 for call by wel1
fstream f2;
f2.open("MAIN",ios::in,ios::binary);
int d=4,comp=5;
f2.seekg(ps*sizeof(pro),ios::beg);
f2.read((char*)&p1,sizeof(pro));
d=strcmp(strupr(id),strupr(id3));
if(d==0)
{
if(z==0)
cout<<"THIS ID ALREADY EXIST";
comp=0;
}
f2.close();
return(comp);
}
int pro::check3(void)
{
char *pop;
int o=9,d=2,z=2;
while(o!=0)
{
pop=getpass("\nENTER YOUR PASSWORD:");
d=strcmp(strupr(pop),strupr(pa));
if(d==0)
{
cout<<"\nPASSWORD MATCHED";
o=0;
rt1.w=1;
z=0;
}
else //PASSWORD NOT MATCHED
{
cout<<"\n\tPASSWORD NOT MATCHED";
clrscr();
cout<<"\n\n\n\t1.WANT TO RETRY"
<<"\n\t2.WANT HELP"
<<"\n\t0.EXIT"
<<"\n\n\tENTER CHOICE : ";
cin>>o;
fflush(stdin);
while((o!=1)&&(o!=2)&&(o!=0))
{
cin>>o;
fflush(stdin);
}
if(o==2)
{

o=help();
if(o==0)
z=0;
if((o!=0)&&(o!=1))
{
z=1;
o=0;
}
rt1.w=1;
}
}
}
return(z);

//z=0 for password match

}
void pro::initial(void)
{
int driver,mode;
driver = DETECT;
initgraph(&driver,&mode,"\\tc\\bgi");
setbkcolor(BLACK);
closegraph();
fstream fo;
char *str;
int d=0,ps=4,comp=2;
clrscr();
ofstream l;
fo.open("RECNO",ios::in,ios::binary);
fo.read((char*)&rec,sizeof(rec));
fo.close();
do
{
cprintf("\nENTER YOUR VALID ID:");
scanf("%20s",&id3);
for(ps=0;ps<rec;ps++)
{
comp=p1.check2(ps,0);
if(comp==0)
break;
}
}while(comp==0);
strcpy(id,id3);
pass = getpass("\nENTER YOUR PASS WORD:");
char pas[10],st[20];
strcpy(pas,pass);
str=getpass("\n\a\aCONFIRM YOUR PASSWORD:");
strcpy(st,str);
do
{
d=strcmp(strupr(pas),strupr(st));
if(d==0)
break;
else
str=getpass("\n\aCONFIRM YOUR PASS WORD:");
strcpy(st,str);
}
while(d!=0);
strcpy(pa,pass);
fflush(stdin);

cprintf("\nENTER YOUR SECURITY QUESTION:");


gets(sq);
fflush(stdin);
fflush(stdin);
cprintf("\nENTER YOUR ANSWER:");
gets(sqa);
fflush(stdin);
fflush(stdin);
cprintf("\nENTER YOUR CURRENT EMAIL ADDRESS:");
scanf("%40s",&ce);
fflush(stdin);
cprintf("\nENTER YOUR FIRST NAME:");
scanf("%20s",&fn);
fflush(stdin);
cprintf("\nENTER YOUR LAST NAME:");
scanf("%20s",&ln);
fflush(stdin);
cprintf("\nENTER YOUR COUNTRY RESIDENCE:");
scanf("%20s",&cr);
fflush(stdin);
cprintf("\nENTER YOUR POSTAL CODE:1100");
scanf("%d",&pc);
cprintf("\nENTER YOUR SEX:");
scanf("%1s",&g);
rec++;
fo.open("RECNO",ios::out,ios::binary);
fo.write((char*)&rec,sizeof(rec));
fo.close();
fflush(stdin);
}
char* pro::dis1(void)
{
char n[30];
strcpy(n,id);
return(n);
}
void pro::check(int z)
{
int flag;
char m;
clrscr();
if(z==9)
cout<<"\n\t\t\t\tSEND EMAIL";
if(z==0)
cout<<"\n\t\t\t\tOPEN INBOX";
do
{
flag=1;
char id1[20]={"/0"};
fflush(stdin);
if(z==9)
cout<<"\n\nENTER ID TO WHOM MAIL IS TO BE SEND :";
if(z==0)
cout<<"\n\nENTER YOUR ID :";
gets(id1);
fflush(stdin);
ifstream l;

l.open("MAIN",ios::in|ios::binary);
int d=2;
while(!l.eof())
{
l.read((char*)&p,sizeof(pro));
d=strcmp(strupr(id1),strupr(id));
if(d==0)
{
flag=2;
break;
}
}
if(flag==2)
{
m='n';
strcpy(rt1.id,id1);
if(z==0)
{
p.check3();
}
}
else
{
cout<<"\n\nID NOT MATCHED ";
cout<<"\n\nWANT TO RETRY(Y/N) ";
cin>>m;
if(m=='n'||m=='N')
rt1.w=0;
}
}while(m=='y'||m=='Y');
if(flag==2)
{
rt1.z=1;
//id match
}
else
rt1.z=0;
//id not match
}
void pro::remail()
{
clr();
int pp=9;
ifstream k;
k.open("MAIL",ios::in|ios::binary);
p.check(0);
if(rt1.w==1)
{
clrscr();
int lo=1;
int xy=5,i=1;
k.read((char*)&i1,sizeof(inbox));
while(!k.eof())
{
xy=strcmp(strupr(rt1.id),strupr(i1.reci));
if(xy==0 && i1.ex==1)
{
clrscr() ;
int driver,mode;
driver=DETECT;

initgraph(&driver,&mode,"\\tc\\bgi");
floodfill(300,220,3);
setcolor(2);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
rectangle(620,20,20,456);
setcolor(2);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
rectangle(600,40,40,436);
setcolor(4);
settextstyle(GOTHIC_FONT,HORIZ_DIR,4);
cout<<lo;
moveto(100,280);
outtext("EMAIL IS SEND BY : ");
outtext(i1.send);
moveto(100,90);
outtext("YOUR EMAIL ");
outtext(i1.in);
moveto(300,70);
setfillstyle(SOLID_FILL,14);
floodfill(100,30,2);
moveto(265,25);
setcolor(5);
outtext("INBOX");
getch();
lo++;
closegraph();
}
k.read((char*)&i1,sizeof(inbox));
}
}
k.close();
char po;
cout<<"WANT TO MOVE YOUR INBOX TO TRASH:";
cin>>po;
if(po=='y'||po=='Y')
{
fstream cv,cv1;
cv.open("MAIL",ios::in|ios::binary);
cv1.open("MAIL1",ios::app||ios::binary);
p.check(0);
if(rt1.w==1)
{
clrscr();
int xy=5,i=1;
cv.seekg(0);
cv.read((char*)&i1,sizeof(inbox));
while(!cv.eof())
{
xy=strcmp(strupr(rt1.id),strupr(i1.reci));
if(xy!=0)
cv1.write((char*)&i1,sizeof(inbox));
cv.read((char*)&i1,sizeof(inbox));
}
}
cv.close();
cv1.close();
cv.open("MAIL1",ios::in|ios::binary);
cv1.open("MAIL",ios::out|ios::binary);

cv.read((char*)&i1,sizeof(inbox));
while(!cv.eof())
{
cv1.write((char*)&i1,sizeof(inbox));
cv.read((char*)&i1,sizeof(inbox));
}
cv.close();
cv1.close();
}
k.close();
clr();
}
void pro::semail()
{
clr();
char mr;
ofstream i;
i.open("MAIL",ios::app|ios::binary);
do
{
p.check(9);
if(rt1.z==1)
{
clrscr();
cprintf("\nNOW YOU CAN WRITE YOUR EMAIL\n");
gets(i1.in);
fflush(stdin);
cprintf("\nENTER YOUR NAME:");
gets(i1.send);
fflush(stdin);
strcpy(i1.reci,rt1.id);
i1.ex=1;
i.write((char*)&i1,sizeof(inbox));
cprintf("\nWANT TO SENT MORE EMAILS(Y/N):");
cin>>mr;
}
}while(mr=='y'||mr=='Y');
i.close();
clr();
}
void pro::newuser()
{
p.initial();
f5.open("RECNO",ios::in,ios::binary);
f5.read((char*)&rec,sizeof(rec));
f5.close();
mp.open("MAIN",ios::app|ios::binary);
mp.seekg((rec-1)*sizeof(pro),ios::beg);
mp.write((char*)&p,sizeof(pro));
mp.close();
start=0;
getch();
clr();
}
int pro::help()
{
char hc,sq1[80],sqa1[100];

int hco=5,z=5,hco1=5;
cout<<"\nHAVE YOU FORGOTTEN YOUR PASSWORD ";
cin>>hc;
fflush(stdin);
while((toupper(hc)!='Y')&&(toupper(hc)!='N')) hc=getch();
fflush(stdin);
if(toupper(hc)=='Y')
{
cout<<"\nANSWER THE FOLLOWING QUESTION : ";//<<sq1;
puts(sq);
fflush(stdin);
cout<<"\nGIVE YOUR ANSWER :";
gets(sqa1);
fflush(stdin);
hco1=strcmp(strupr(sqa1),strupr(sqa));
if(hco1==0)
z=0;
}
else z=1;
return(z);

//z=0 for success


//z=1 for retry
//else to make him quit

}
void main()
{
clrscr();
welcome_screen();
closegraph();
p.style1();
x:p.wel1();
if(start==0)
{
int ch,ch2;
int graphdriver = DETECT, graphmode,i=0;
initgraph(&graphdriver, &graphmode, "..//bgi");
r=395;
co=1;
int s=0;
setcolor(0);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setbkcolor(0);
while(!kbhit())
{
r=397;
co++;
if(co==0)
co+=4;
while(r>=10)
{
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
setcolor(s=co-2);
outtextxy(250,90,"MENU");

setlinestyle(SOLID_LINE,1,3);
line(250,130,320,130);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
outtextxy(150,150,"1.SEND EMAIL");
outtextxy(150,180,"2.READ EMAIL");
outtextxy(150,210,"3.EXIT");
outtextxy(150,380,"PRESS CHOICE");
re();
delay(5);
r--;
if (kbhit())
{
ch2 = getch();
break;
}
}
char *ch1;
outtextxy(3600,380,itoa(ch2,ch1,10));
ch2-=48;
if(ch2==1||ch2==2||ch2==3)//||ch2==4)
break;
}
setbkcolor(BLACK);
closegraph();
switch(ch2)
{
case 1:p.semail();
clr();
case 2:p.remail();
clr();
goto x;
case 3:exit(2);
clr();
break;
}
}
getche();
}
//DECLARATION OF ALL NON CLASS FUNCTIONS
void re()
{
setcolor(co);
circle(320,240,r);
}
void clr(void)
//function to clear main creen line by line
{
_setcursortype(_NOCURSOR);
for(int j=1;j<13;j++)
{
gotoxy(1,j);
clreol();
delay(100);
gotoxy(1,26-j);
clreol();
delay(5);
}
clrscr();

}
void init()
//Function to initialize the screen
{
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\bgi");
}
void stars()
{
setfillstyle(7,13); // to det. the shape and the color of the boxes
while (!kbhit())
{
for (int i=1;i<=tn;i++)
{
bar(star[i].posx,star[i].posy,star[i].posx+2*(star[i].rad/50),st
ar[i].posy+2*(star[i].rad/50));
star[i].speed=star[i].rad/60+1;
star[i].rad=star[i].rad+star[i].speed;
}
delay(del);
for (i=1;i<=tn;i++) putimage(star[i].posx,star[i].posy,star[i].i
mage,0);
for (i=1;i<=tn;i++)
{
star[i].posx=(star[i].rad*sin(star[i].ang))+320;
star[i].posy=(star[i].rad*cos(star[i].ang))+240;
check(i);
getimage(star[i].posx,star[i].posy,star[i].posx+2*(star[i].rad/5
0),star[i].posy+2*(star[i].rad/50),star[i].image);
}
}
}
void check(int i)
{
if (i==tn) if (star[i].rad!=star[i-1].rad) del=20;
if ((star[i].posx<10) || (star[i].posx>620) || (star[i].posy<10) || (star[i].pos
y>460))
{
star[i].ang=random(360);
star[i].rad=random(200);
star[i].posx=(star[i].rad*sin(star[i].ang))+320;
star[i].posy=(star[i].rad*cos(star[i].ang))+240;
}
}
void op (void)
{
setcolor(2);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
rectangle(620,20,20,456);
setcolor(2);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
rectangle(600,40,40,436);

You might also like