Hangman Game
Hangman Game
Hangman Game
*/
//HEADER FILES
#include<fstream.h>
#include<bios.h>
#include<time.h>
#include<dos.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<graphics.h>
#include<conio.h>
#include<mouse.h>
#define SMILE 1
#define SAD 0
void drawsetup();
void game();
void play();
void initgraphics();
void show_main_menu();
void getoption();
settextstyle(3,0,3);
setcolor(RED);
outtextxy(130,200,"Programmed By:");
settextstyle(1,0,3);
setcolor(WHITE);
outtextxy(330,200,"Manish Jain");
outtextxy(150,235,"mkj_manishjain@yahoo.co.in");
outtextxy(150,275," +91 9896455735");
settextstyle(1,0,4);
setcolor(RED);
outtextxy(120,360,"Press any key to play");
getch();
}
settextstyle(3,0,5);
for(i=0;i<4;i++)
{
setcolor(WHITE);
outtextxy(67,190+(45*i),categories[i]);
setcolor(RED);
rectangle(50,210+(45*i),60,220+(45*i));
outtextxy(cat_pos_x[i],190+(45*i),c_m[i]);
}
getoption();
}
//GETTING THE CHOICE FROM THE USER FOR THE MAIN MENU
void get_mm_choice()
{
get:
int cho=bioskey(0);
cho=cho>>8;
switch(cho)
{
case 2:
case 25:
case 28:
case 79: play();
break;
case 3:
case 23:
case 80: instruction();
break;
case 4:
case 35:
case 81: hiscore();
break;
case 5:
case 18:
case 75: exit(0);
break;
default: goto get;
}
}
for(i=0;i<4;i++)
{
setcolor(WHITE);
outtextxy(67,180+(35*i),main_menu[i]);
setcolor(RED);
outtextxy(130,180+(35*i),m_m[i]);
}
get_mm_choice();
}
setcolor(BLUE);
rectangle(8,8,mx-8,my-8);
setcolor(RED);
rectangle(9,9,mx-9,my-9);
line(10,381,mx-10,381);
line(10,341,468,341);
line(10,301,468,301);
line(10,65,330,65);
setcolor(GREEN);
rectangle(10,10,mx-10,my-10);
line(10,380,mx-10,380);
line(10,340,468,340);
line(10,300,468,300);
line(10,66,330,66);
bar(468,10,472,380);
bar(188,10,192,66);
bar(328,10,332,66);
settextstyle(1,0,3);
_strdate(datebuf);
outtextxy(220,10,"DATE");
outtextxy(200,30,datebuf);
settextstyle(8,0,7);
outtextxy(50,360,"H A N G M A N");
setcolor(YELLOW);
outtextxy(48,360,"H A N G M A N");
setcolor(WHITE);
outtextxy(46,360,"H A N G M A N");
settextstyle(2,0,4);
outtextxy(46,446,"c"); //COPYRIGHT SYMBOL
circle(48,453,4);
settextstyle(3,0,3);
outtextxy(56,435," Fantasatic Four (P) Ltd. 2003-07");
settextstyle(3,0,4);
setcolor(BLUE);
outtextxy(500,18,"Player");
settextstyle(3,0,2);
setcolor(WHITE);
outtextxy(510-(strlen(name)*2),55,name);
setcolor(GREEN);
settextstyle(1,0,5);
outtextxy(40,13,category);
drawhanger();
}
strcpy(string,rec.returnword());
len=strlen(string);
setcolor(GREEN);
settextstyle(1,0,4);
for(i=0;string[i]!='\0';i++)
{ //DISPLAYING THE BLANK SPACES('_') FOR EACH CHARACTER
if((string[i]>=48 &&string[i]<=57) ||(string[i]>=65 &&string[i] <=90)
||
(string[i] >=97 &&string[i] <=122))
{
outtextxy(blankpos_x[i%16],blankpos_y[i/16]," _ ");
count_s++;
}
else
{ //DISPLAYING THE COMMA(',') FOR EACH SPACE
outtextxy(blankpos_x[i%16],blankpos_y[i/16]," , ");
spaces++;
}
}
setcolor(RED);
outtextxy(50,300,"\nPRESS ANY KEY TO PLAY");
getch();
setcolor(getbkcolor());
outtextxy(50,300,"\nPRESS ANY KEY TO PLAY");
setcolor(GREEN);
//FUN
//FUNCTION TO INITIALISE GRAPHICS
void initgraphics()
{
d=DETECT;
initgraph(&d,&m,"..//bgi");
mx=getmaxx();
my=getmaxy();
}
void play()
{
init();
chooseoption();
drawsetup();
game();
}
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: