C++ Project, Bollywood
Bollywood Project C++ | Computer Programming - IMTEG
What is a project in C++?
The Microsoft C++ compiler, like most integrated development environments, combines source files into a project. A "project" is a group of files that contain related source code; in addition, a project may contain other resources, such as icons, menus and widgets.
The Microsoft C++ compiler, like most integrated development environments, combines source files into a project. A "project" is a group of files that contain related source code; in addition, a project may contain other resources, such as icons, menus and widgets.
CODING
#include<graphics.h> #include<math.h> #include<conio.h> #include<string.h> #include<fstream.h> #include<stdlib.h> #include<time.h> classhscore { char name[20]; int score; public: hscore(char *n, int x) { strcpy(name,n); score=x; } hscore(){} intretscore() { return score; } char *retname() { return name; } }; void frame(int,int,int); char *input(int,int); void welcome(int,int); void game(int,int,int&,int,int&); voidhighscore(int,int); voidgameover(int,int,hscore); void main() { intgdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi"); intmaxx=getmaxx(),maxy=getmaxy(),score=0,sc,ctrgame; welcome(maxx,maxy); char name[20]; |
strcpy(name,input(maxx,maxy));
for(inti=0;i<10;i++)
{
game(maxx,maxy,sc,i+1,ctrgame);
getch();
for(inti=0;i<10;i++)
{
game(maxx,maxy,sc,i+1,ctrgame);
getch();
cleardevice();
if(ctrgame==0)
{
break;
}
score+=sc;
}
hscore data(name,score);
gameover(maxx,maxy,data);
getch();
closegraph();
}
void frame(intmaxx,intmaxy,int color)
{
setcolor(WHITE);
setfillstyle(CLOSE_DOT_FILL,color);
rectangle(0,0,maxx,maxy);
rectangle(20,20,maxx-20,maxy-20);
floodfill(10,10,WHITE);
}
void welcome(intmaxx,intmaxy)
{
frame(maxx,maxy,LIGHTGRAY);
settextstyle(GOTHIC_FONT,0,7);
setcolor(BROWN);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(maxx/2,150,"welcome");
outtextxy(maxx/2,200,"to");
outtextxy(maxx/2,250,"bollywood");
getch();
cleardevice();
}
char *input(intmaxx,intmaxy)
{
frame(maxx,maxy,RED);
settextstyle(GOTHIC_FONT,0,5);
setcolor(RED);
outtextxy(maxx/2,maxy/2 -50,"enter name");
char name[20],ch;
inti=0;
name[0]='\0';
while(1)
{
setcolor(BLUE);
outtextxy(maxx/2,maxy/2,name);
ch=getch();
setcolor(BLACK);
outtextxy(maxx/2,maxy/2,name);
if(ch!=13)
}
cleardevice();
return name;
}
void game(intmaxx,intmaxy,int&score,intlevel,int&ctrwin)
{
randomize();
ifstream file("movies.dat");
if(!file)
{
cout<<"\nCANNOT OPEN THE FILE!:";
getch();
exit(0);
}
charlevelname[20],l[10];
itoa(level,l,10);
strcpy(levelname,"LEVEL");
strcat(levelname,l);
intctr=random(27),i=0;
charmov[20];
while(!file.eof())
{
file.getline(mov,20);
if(ctr==i)break;
i++;
}
chardisp[20],bolly[]="bollywood",used[26],wrong[10];
used[0]='\0';
wrong[0]='\0';
int size=strlen(mov);
for(i=0;i<size;i++)
{
if(mov[i]<123&&mov[i]>96)
{
disp[i]='*';
}
cleardevice();
return name;
}
void game(intmaxx,intmaxy,int&score,intlevel,int&ctrwin)
{
randomize();
ifstream file("movies.dat");
if(!file)
{
cout<<"\nCANNOT OPEN THE FILE!:";
getch();
exit(0);
}
charlevelname[20],l[10];
itoa(level,l,10);
strcpy(levelname,"LEVEL");
strcat(levelname,l);
intctr=random(27),i=0;
charmov[20];
while(!file.eof())
{
file.getline(mov,20);
if(ctr==i)break;
i++;
}
chardisp[20],bolly[]="bollywood",used[26],wrong[10];
used[0]='\0';
wrong[0]='\0';
int size=strlen(mov);
for(i=0;i<size;i++)
{
if(mov[i]<123&&mov[i]>96)
{
disp[i]='*';
}
{
if(ch==8&&i!=0)
{
name[i-1]='\0';
i--;
}
else if(ch!=8)
{
name[i++]=ch;
name[i]='\0';
}
}
else
{
break;
}
else
{
disp[i]=mov[i];
}
}
disp[i]='\0';
frame(maxx,maxy,BROWN);
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(DEFAULT_FONT,0,4);
setcolor(BROWN);
outtextxy(maxx/2,100,levelname);
setcolor(GREEN);
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(GOTHIC_FONT,0,7);
outtextxy(maxx/2,150,disp);
setcolor(BLUE);
settextstyle(GOTHIC_FONT,0,6);
outtextxy(maxx/2,230, bolly);
clock_tend,start;
charch;
int err=0,ctrerr,ctrused=0,ctrwrong=0;
start = clock();
while(err!=9)
{
do
{
ch=getch();
for(i=0;i<ctrused;i++)
{
{
if(ch==8&&i!=0)
{
name[i-1]='\0';
i--;
}
else if(ch!=8)
{
name[i++]=ch;
name[i]='\0';
}
}
else
{
break;
}
else
{
disp[i]=mov[i];
}
}
disp[i]='\0';
frame(maxx,maxy,BROWN);
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(DEFAULT_FONT,0,4);
setcolor(BROWN);
outtextxy(maxx/2,100,levelname);
setcolor(GREEN);
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(GOTHIC_FONT,0,7);
outtextxy(maxx/2,150,disp);
setcolor(BLUE);
settextstyle(GOTHIC_FONT,0,6);
outtextxy(maxx/2,230, bolly);
clock_tend,start;
charch;
int err=0,ctrerr,ctrused=0,ctrwrong=0;
start = clock();
while(err!=9)
{
do
{
ch=getch();
for(i=0;i<ctrused;i++)
{
c++ projects with source code and documentation free download, 1000 projects in c++ with source code, c++ projects with source code, object-oriented programming c++ projects, advanced c++ projects with source code, c++ programs for class 12, c++ projects with source code github, simple c++ projects with source code