0% found this document useful (0 votes)
252 views24 pages

KBC Project

This document contains code for a C++ program that implements a quiz game show similar to "Kaun Banega Crorepati". It includes functions for displaying questions and options, taking the player's answer, simulating communication with a friend on the phone for help, and displaying the audience poll. The main function initializes the game, gets the player's name and location, and calls other functions to start the quiz rounds and track the player's progress and winnings.

Uploaded by

Roop Kishore
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
252 views24 pages

KBC Project

This document contains code for a C++ program that implements a quiz game show similar to "Kaun Banega Crorepati". It includes functions for displaying questions and options, taking the player's answer, simulating communication with a friend on the phone for help, and displaying the audience poll. The main function initializes the game, gets the player's name and location, and calls other functions to start the quiz rounds and track the player's progress and winnings.

Uploaded by

Roop Kishore
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Coding

#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<fstream.h>

// FOR GOTOXY() & TEXTCOLOR() ETC


// FOR GETS() & PUTS() ETC
// FOR DRAWING PURPOSE
// FOR DELAY()
// FOR RANDOMIZE FUNCTION

union REGS i,o;


struct SREGS s;
int x,y,button,mouseflag=0;
int q_poly[12]={25,345,
50,315,
450,315,
475,345,
450,375,
50,375};
int opt1_poly[12]={25,404,
50,384,
210,384,
235,404,
210,424,
50,424};
int opt2_poly[12]={265,404,
290,384,
450,384,
475,404,
450,424,
290,424};
int opt3_poly[12]={25,452,
50,432,
210,432,
235,452,
210,472,
50,472};
int opt4_poly[12]={265,452,
290,432,
450,432,
475,452,
450,472,
290,472};
int mouseshape[32]={0xF7ff,0xe3ff,0xe3ff,0xe1ff, //hand shape
0xe07f,0xe01f,0x200f,0x000f,
0x000f,0x800f,0x800f,0xc00f,
0xe01f,0xf01f,0xf01f,0xf01f,
0x0000,0x0800,0x0800,0x0800,
0x0a00,0x0a80,0x0aa0,0x4fa0,
0x6fe0,0x3fe0,0x3fe0,0x1fe0,
0x0fc0,0x07c0,0x07c0,0x0000,};
int initmouse();
void showmouseptr();
void hidemouseptr();
void getmousepos();
delay(250);

outtextxy(210,100,"a");
delay(250);
outtextxy(240,100,"u");
delay(250);
outtextxy(275,100,"n");
delay(250);
outtextxy(187,150,"B");
delay(250);
outtextxy(232,150,"a");
delay(250);
outtextxy(262,150,"n");
delay(250);
outtextxy(297,150,"e");
delay(250);
outtextxy(322,150,"g");
delay(250);
outtextxy(357,150,"a");
delay(250);
outtextxy(210,205,"C");
delay(250);
outtextxy(250,205,"r");
delay(250);
outtextxy(275,205,"o");
delay(250);
outtextxy(307,205,"r");
delay(250);
outtextxy(335,205,"e");
delay(250);
outtextxy(365,205,"p");
delay(250);
outtextxy(395,205,"a");
delay(250);
outtextxy(425,205,"t");
delay(250);
outtextxy(450,205,"i");
setcolor(2);
outtextxy(165,100,"K");
outtextxy(187,150,"B");
outtextxy(210,205,"C");
getch();
}

}
int _50_50(int x)
{
int y,i;
int op_[4]={1,1,1,1};
randomize();
do
{
y= rand() % 4;
}while(y==x);
setcolor(14);

setfillstyle(1,1);
op_[y]=0;
op_[x]=0;
for( i=0;i<4;i++)
{
if(op_[i]==1)
{
switch(i)
{
case 0:fillpoly(6,opt1_poly);
break;
case 1:fillpoly(6,opt2_poly);
break;
case 2:fillpoly(6,opt3_poly);
break;
case 3:fillpoly(6,opt4_poly);
break;
}
}
}
return y;
}
void audie_af_50(int x,int y)
{
int opt[2],i;
char word[10];
randomize();
do
{
for(i=0; i<2; i++)
opt[i]= rand() % 100;
}while(opt[0]+opt[1]!=60);
opt[0]+=40;
setcolor(14);
line(250,165,250,265);
line(465,165,465,265);
line(250,265,465,265);
line(250,165,465,165);
line(465,175,470,175);
line(465,185,470,185);
line(465,195,470,195);
line(465,205,470,205);
line(465,215,470,215);
line(465,225,470,225);
line(465,235,470,235);
line(465,245,470,245);
line(465,255,470,255);
setfillstyle(1,14);
for(i=0;i<4;i++)
outtextxy(275+50*i,155,"0");
setcolor(1);
outtextxy(275+50*x,155,"0");
outtextxy(275+50*y,155,"0");
setcolor(14);
bar(270+50*x,265-opt[0],300+50*x,265);
itoa(opt[0],word,10);
outtextxy(275+50*x,155,word);

bar(270+50*y,265-opt[1],300+50*y,265);
itoa(opt[1],word,10);
outtextxy(275+50*y,155,word);
outtextxy(282,275,"A");
outtextxy(333,275,"B");
outtextxy(380,275,"C");
outtextxy(432,275,"D");
delay(2000);
}
void phone_af_50()
{
int i;
setcolor(14);
outtextxy(25,110,"Dailing the number");
for(i=0;i<7;i++)
{
sound(3500);
delay(10);
nosound();
delay(300);
}
for(i=0;i<3;i++)
{
sound(350);
delay(200);
nosound();
delay(300);
}
outtextxy(25,125,"AMITABH : Hello ! Mein Amitabh Bachchan bol raha hoon ");
outtextxy(105,135,"Kaun Banega CrorePati se.");
delay(1000);
outtextxy(25,150,"FRIEND : Nice to hear your voice Mr. Bachchan.");
delay(1000);
outtextxy(25,165,"AMITABH : Your friend needs your help and you have only ");
outtextxy(105,175,"30 seconds.And your time starts now.");
delay(299);
stop_clock();
int friend_cho,friend_perc;
randomize();
friend_cho=rand()%2;
outtextxy(25,190,"FRIEND : I think
choice is correct");
switch(friend_cho)
{
case 0:outtextxy(175,190,"first");
break;
case 1:outtextxy(170,190,"second");
break;
}
stop_clock1();
outtextxy(25,205,"USER : Are you sure ?");
randomize();
friend_perc=rand()%5;
outtextxy(25,220,"FRIEND : I am sure.");
switch(friend_perc)
{
case 0:outtextxy(150,220,"75%");
break;

case 1:outtextxy(150,220,"90%");
break;
case 2:outtextxy(150,220,"80%");
break;
case 3:outtextxy(150,220,"85%");
break;
case 4:outtextxy(150,220,"60%");
}
outtextxy(25,235,"USER : O.K. Bye");
setcolor(6);
setfillstyle(1,14);
fillellipse(405,245,31,31);
setcolor(1);
setfillstyle(1,1);
sector(405,245,90,90,30,30);
delay(1600);
setcolor(14);
outtextxy(25,250,"AMITABH : Enter your choice");
}
void audience(int x)
{
int opt[4],i;
char word[10];
randomize();
do
{
for(i=0; i<4; i++)
opt[i]= rand() % 100;
}while(opt[0]+opt[1]+opt[2]+opt[3]!=70);
setcolor(14);
line(250,165,250,265);
line(465,165,465,265);
line(250,265,465,265);
line(250,165,465,165);
line(465,175,470,175);
line(465,185,470,185);
line(465,195,470,195);
line(465,205,470,205);
line(465,215,470,215);
line(465,225,470,225);
line(465,235,470,235);
line(465,245,470,245);
line(465,255,470,255);
opt[x]+=30;
// CORRECT CHOICE
setfillstyle(1,14);
for(i=0;i<4;i++)
bar(270+50*i,265-opt[i],300+50*i,265);
outtextxy(282,275,"A");
outtextxy(333,275,"B");
outtextxy(380,275,"C");
outtextxy(432,275,"D");
for(i=0;i<4;i++)
{
itoa(opt[i],word,10);
outtextxy(275+50*i,155,word);
}
delay(2000);

}
void PHONE()
{
int friend_cho,friend_perc,i;
setcolor(14);
outtextxy(25,110,"Dailing the number");
for(i=0;i<7;i++)
{
sound(3500);
delay(10);
nosound();
delay(300);
}
for(i=0;i<3;i++)
{
sound(350);
delay(200);
nosound();
delay(300);
}
outtextxy(25,125,"AMITABH : Hello ! Mein Amitabh Bachchan bol raha hoon ");
outtextxy(105,135,"Kaun Banega CrorePati se.");
delay(1000);
outtextxy(25,150,"FRIEND : Nice to hear your voice Mr. Bachchan.");
delay(1000);
outtextxy(25,165,"AMITABH : Your friend needs your help and you have only ");
outtextxy(105,175,"30 seconds.And your time starts now.");
delay(299);
stop_clock();
randomize();
friend_cho=rand()%4;
outtextxy(25,190,"FRIEND : I think choice is correct");
switch(friend_cho)
{
case 0:outtextxy(175,190,"A");
break;
case 1:outtextxy(175,190,"B");
break;
case 2:outtextxy(175,190,"C");
break;
case 3:outtextxy(175,190,"D");
}
stop_clock1();
outtextxy(25,205,"USER : Are you sure ?");
randomize();
friend_perc=rand()%5;
outtextxy(25,220,"FRIEND : I am sure.");
switch(friend_perc)
{
case 0:outtextxy(150,220,"75%");
break;
case 1:outtextxy(150,220,"90%");
break;
case 2:outtextxy(150,220,"80%");
break;
case 3:outtextxy(150,220,"85%");
break;

case 4:outtextxy(150,220,"60%");
}
outtextxy(25,235,"USER : O.K. Bye");
setcolor(6);
setfillstyle(1,14);
fillellipse(405,245,31,31);
setcolor(14);
delay(1600);
outtextxy(25,250,"AMITABH : Enter your choice");
}
void _exit()
{
int gdriver=DETECT,gmode,sc=0;
initgraph(&gdriver,&gmode,"\\tc\\bgi");
settextstyle(1,0,5);
setcolor(14);
do
{
outtextxy(75,50+sc," !!!!! TRY AGAIN !!!!!");
delay(250);
cleardevice();
sc=sc+50;
if(sc>400)
sc=0;
}while(!kbhit());
getch();
closegraph();
}
struct player
{
char name[35];
char city[20];
long double win;
}p1;
struct question
{
char quest[150];
char option1[60];
char option2[60];
char option3[60];
char correct[60];
}q1;
void main()
{
int i,X,Y,Color,ques_no,gdriver=DETECT,gmode,main_cho,want;
ofstream o1;
initgraph(&gdriver,&gmode,"\\tc\\bgi");
startup();
closegraph();
main_start:
textcolor(4);
clrscr();
textcolor(1);
gotoxy(20,5);

cprintf("");
gotoxy(20,6);
cprintf("
");
gotoxy(20,7);
cprintf("");
textcolor(4);
gotoxy(25,6);
cprintf("WELCOME TO KAUN BANEGA CROREPATI");
gotoxy(31,10);
cout<<"ENTER..............1";
gotoxy(31,13);
cout<<"LIST OF USERS......2";
gotoxy(31,16);
cout<<"EXIT...............0";
gotoxy(31,19);
cout<<"ENTER YOUR CHOICE ";
cin>>main_cho;
if(main_cho!=0&&main_cho!=1&&main_cho!=2)
goto main_start;
if(main_cho==0)
goto end;
if(main_cho==2)
{
clrscr();
gotoxy(56,1);
cout<<"PRESS ESC TO EXIT";
gotoxy(10,2);
cout<<"NAMES";
gotoxy(36,2);
cout<<"CITY";
gotoxy(60,2);
cout<<"PRIZE MONEY (Rs) ";
ifstream f1;
f1.open("customer",ios::in,ios::nocreate);
if(f1==0)
{
gotoxy(30,12);
cout<<"NO RECORDS TILL NOW!!!!";
getch();
goto main_start;
}
f1.read((char*)&p1,sizeof(p1));
int i=1;
do
{
gotoxy(3,3+i%20);
cout<<p1.name;
gotoxy(32,3+i%20);
cout<<p1.city;
gotoxy(62,3+i%20);
cout<<p1.win;
if(i%20==0)
{
want=getch();

if(want==27)
goto main_start;
else
{
clrscr();
gotoxy(56,1);
cout<<"PRESS ESC TO EXIT";
gotoxy(10,2);
cout<<"NAMES";
gotoxy(40,2);
cout<<"CITY";
gotoxy(60,2);
cout<<"PRIZE MONEY
";
}
}
f1.read((char*)&p1,sizeof(p1));
i++;
}while(f1);
getch();
f1.close();
goto main_start;
}
if(main_cho==1)
{
textcolor(4);
clrscr();
textcolor(1);
gotoxy(20,5);
cprintf("");
gotoxy(20,6);
cprintf("
");
gotoxy(20,7);
cprintf("");
textcolor(4);
gotoxy(25,6);
cprintf("WELCOME TO KAUN BANEGA CROREPATI");
gotoxy(10,10);
cout<<"ENTER YOUR NAME
: ";
gets(p1.name);
gotoxy(10,13);
cout<<"ENTER YOUR CITY
: ";
gets(p1.city);
strupr(p1.name);
strupr(p1.city);
char name[35];
long phone;
gotoxy(10,16);
cout<<"ENTER YOUR FRIEND'S NAME
: ";
gets(name);
gotoxy(10,19);
cout<<"ENTER YOUR FRIEND'S PHONE NUMBER : ";
cin>>phone;
initgraph(&gdriver,&gmode,"\\tc\\bgi");
if(initmouse()==0)
mouseflag=1;
if(mouseflag==0)
{

changecursor(mouseshape);
showmouseptr();
}
settextstyle(1,0,1);
setcolor(12);
outtextxy(525,10,"PROGRESS");
outtextxy(545,35,"CHART");
setcolor(15);
outtextxy(525,75,"10000000");
outtextxy(525,100," 5000000");
outtextxy(525,125," 2500000");
outtextxy(525,150," 1250000");
outtextxy(525,175," 640000");
outtextxy(525,200," 320000");
outtextxy(525,225," 160000");
outtextxy(525,250," 80000");
outtextxy(525,275," 40000");
outtextxy(525,300," 20000");
outtextxy(525,325," 10000");
outtextxy(525,350," 5000");
outtextxy(525,375," 3000");
outtextxy(525,400," 2000");
outtextxy(525,425," 1000");
setcolor(4);
settextstyle(2,0,5);
outtextxy(203,3," LIFE LINES");
setcolor(6);
line(500,1,500,480);
line(499,1,499,480);
line(498,1,498,480);
line(497,1,497,480);
setfillstyle(1,6);
setcolor(14);
fillellipse(105,50,45,30);
fillellipse(245,50,45,30);
fillellipse(385,50,45,30);
settextstyle(2,0,7);
outtextxy(74,39,"50::50");
settextstyle(2,0,5);
outtextxy(223,25,"PHONE");
outtextxy(240,40,"A");
outtextxy(220,55,"FRIEND");
outtextxy(345,37," AUDIENCE");
outtextxy(346,52," POLL");
screen();
settextstyle(1,0,2);
setcolor(14);
outtextxy(5,335,"Q");
outtextxy(5,390,"A");
outtextxy(245,390,"B");
outtextxy(5,440,"C");
outtextxy(245,440,"D");
int phone_life=0,fifty_life=0,audie_life=0;
char correct[60];
int selection_no;
int file_length1=0;
ifstream f1;

10

f1.open("easy_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length1++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
if(file_length1<5)
{
ofstream o1;
f1.open("easy_bac",ios::in);
o1.open("easy_que",ios::trunc);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
o1.write((char*)&q1,sizeof (q1));
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
o1.close();
}
file_length1=0;
f1.open("norm_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length1++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
if(file_length1<5)
{
ofstream o1;
f1.open("norm_bac",ios::in);
o1.open("norm_que",ios::trunc);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
o1.write((char*)&q1,sizeof (q1));
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
o1.close();
}
file_length1=0;
f1.open("diff_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length1++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
if(file_length1<5)

11

{
ofstream o1;
f1.open("diff_bac",ios::in);
o1.open("diff_que",ios::trunc);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
o1.write((char*)&q1,sizeof (q1));
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
o1.close();
}
int sahi;
int option_no[4];
randomize();
char user_cho;
char que_temp[51];
char que_temp1[51];
char que_temp2[51];
char option_temp[20];
char option_temp1[20];
char option_temp2[20];
instructions();
screen();
for(ques_no=1;ques_no<16;ques_no++)
{
int file_length=0;
sahi=0;
if(ques_no<6)
{
ifstream f1;
f1.open("easy_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
}
if(ques_no>5&&ques_no<11)
{
ifstream f1;
f1.open("norm_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
}
if(ques_no>10)
{

12

ifstream f1;
f1.open("diff_que",ios::in);
f1.read((char*)&q1,sizeof (q1));
while(f1)
{
file_length++;
f1.read((char*)&q1,sizeof (q1));
}
f1.close();
}
selection_no=(rand()%file_length)+1;
settextstyle(1,0,1);
setcolor(4);
switch(ques_no)
{
case 1:setcolor(2);
outtextxy(525,425," 1000");
break;
case 2:outtextxy(525,425," 1000");
setcolor(2);
outtextxy(525,400," 2000");
break;
case 3:outtextxy(525,400," 2000");
setcolor(2);
outtextxy(525,375," 3000");
break;
case 4:outtextxy(525,375," 3000");
setcolor(2);
outtextxy(525,350," 5000");
break;
case 5:outtextxy(525,350," 5000");
setcolor(2);
outtextxy(525,325," 10000");
break;
case 6:outtextxy(525,325," 10000");
setcolor(2);
outtextxy(525,300," 20000");
break;
case 7:outtextxy(525,300," 20000");
setcolor(2);
outtextxy(525,275," 40000");
break;
case 8:outtextxy(525,275," 40000");
setcolor(2);
outtextxy(525,250," 80000");
break;
case 9:outtextxy(525,250," 80000");
setcolor(2);
outtextxy(525,225," 160000");
break;
case 10:outtextxy(525,225," 160000");
setcolor(2);
outtextxy(525,200," 320000");
break;
case 11:outtextxy(525,200," 320000");
setcolor(2);
outtextxy(525,175," 640000");

13

break;
case 12:outtextxy(525,175," 640000");
setcolor(2);
outtextxy(525,150," 1250000");
break;
case 13:outtextxy(525,150," 1250000");
setcolor(2);
outtextxy(525,125," 2500000");
break;
case 14:outtextxy(525,125," 2500000");
setcolor(2);
outtextxy(525,100," 5000000");
break;
case 15:outtextxy(525,100," 5000000");
setcolor(2);
outtextxy(525,75,"10000000");
}
setcolor(14);
if(ques_no<6)
{
f1.open("easy_que",ios::in);
for(int j=1;j<=selection_no;j++)
f1.read((char*)&q1,sizeof (q1));
f1.close();
}
if(ques_no>5&&ques_no<11)
{
f1.open("norm_que",ios::in);
for(int j=1;j<=selection_no;j++)
f1.read((char*)&q1,sizeof (q1));
f1.close();
}

switch(option_no[0])
{
case 0:outtextxy(50,400,q1.option1);
break;
case 1:outtextxy(300,400,q1.option1);
break;
case 2:outtextxy(50,445,q1.option1);
break;
case 3:outtextxy(300,445,q1.option1);
break;
}
switch(option_no[1])
{
case 0:outtextxy(50,400,q1.option2);
break;
case 1:outtextxy(300,400,q1.option2);
break;
case 2:outtextxy(50,445,q1.option2);
break;
case 3:outtextxy(300,445,q1.option2);
break;

14

}
switch(option_no[2])
{
case 0:outtextxy(50,400,q1.option3);
break;
case 1:outtextxy(300,400,q1.option3);
break;
case 2:outtextxy(50,445,q1.option3);
break;
case 3:outtextxy(300,445,q1.option3);
break;
}
switch(option_no[3])
{
case 0:outtextxy(50,400,q1.correct);
break;
case 1:outtextxy(300,400,q1.correct);
break;
case 2:outtextxy(50,445,q1.correct);
break;
case 3:outtextxy(300,445,q1.correct);
break;
}
WRONG:
outtextxy(25,125,"AMITABH : ENTER YOUR CHOICE ");
if(mouseflag==0)
{
showmouseptr();
while(!kbhit())
{
getmousepos(&button,&x,&y);
if((button&1)==1)
{
if(x>50&&x<210&&y>384&&y<424)
{
user_cho='A';
goto JUMP;
}
else if(x>290&&x<450&&y>384&&y<424)
{
user_cho='B';
goto JUMP;
}
else if(x>50&&x<210&&y>432&&y<472)
{
user_cho='C';
goto JUMP;
}

if(x>50&&x<210&&y>432&&y<472)
if(getpixel(27,452)==1)
{
hidemouseptr();
floodfill(27,452,14);

//OPTION C

15

showmouseptr();
do{getmousepos(&button,&x,&y);
}while(x>50&&x<210&&y>432&&y<472&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,1);
hidemouseptr();
floodfill(27,452,14);
showmouseptr();
setfillstyle(1,12);
}
if(x>290&&x<450&&y>432&&y<472)
//OPTION D
if(getpixel(267,452)==1)
{
hidemouseptr();
floodfill(267,452,14);
showmouseptr();
do{getmousepos(&button,&x,&y);
}while(x>290&&x<450&&y>432&&y<472&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,1);
hidemouseptr();
floodfill(267,452,14);
showmouseptr();
setfillstyle(1,12);
}
int delta;
char user_cho1;
if(user_cho=='F'||user_cho=='f')
{
if(fifty_life==0)
{
setcolor(14);
delta=_50_50(option_no[3]);
fifty_life=1;
setlinestyle(0,0,3);
setcolor(4);
if(mouseflag==0)
hidemouseptr();
line(60,20,150,80);
line(60,80,150,20);
if(mouseflag==0)
showmouseptr();
setcolor(1);
setfillstyle(1,1);
bar(21,106,475,295);
setcolor(14);
setlinestyle(0,0,1);
WRONG1:
outtextxy(25,125,"AMITABH : ENTER YOUR CHOICE ");
if(mouseflag==0)
{
while(!kbhit())
{
getmousepos(&button,&x,&y);
if((button&1)==1)
{
if(x>50&&x<210&&y>384&&y<424)
{

16

user_cho1='A';
goto JUMP1;
}
else if(x>290&&x<450&&y>384&&y<424)
{
user_cho1='B';
goto JUMP1;
}
if(x>290&&x<450&&y>432&&y<472)
//OPTION D
if(getpixel(267,452)==1)
{
hidemouseptr();
floodfill(267,452,14);
showmouseptr();
do{getmousepos(&button,&x,&y);
}while(x>290&&x<450&&y>432&&y<472&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,1);
hidemouseptr();
floodfill(267,452,14);
showmouseptr();
setfillstyle(1,12);
}
if(((x-105.00)*(x-105.00)/2025.00)+((y-50.00)*(y-50.00)/900.00)<1.00)
if(getpixel(77,31)==6)
{
hidemouseptr();
floodfill(62,50,14);
showmouseptr();
do{getmousepos(&button,&x,&y);
}while(((x-105.00)*(x-105.00)/2025.00)+((y-50.00)*(y50.00)/900.00)<1.00&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,6);
hidemouseptr();
floodfill(62,50,14);
showmouseptr();
setfillstyle(1,12);
}

// FIFTY_FIFTY

if(((x-245.00)*(x-245.00)/2025.00)+((y-50.00)*(y-50.00)/900.00)<1.00)
if(getpixel(217,31)==6)
{
hidemouseptr();
floodfill(202,50,14);
showmouseptr();
do{getmousepos(&button,&x,&y);
}while(((x-245.00)*(x-245.00)/2025.00)+((y-50.00)*(y50.00)/900.00)<1.00&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,6);
hidemouseptr();
floodfill(202,50,14);
showmouseptr();
setfillstyle(1,12);
}

// PHONE

if(((x-385.00)*(x-385.00)/2025.00)+((y-50.00)*(y-50.00)/900.00)<1.00)
if(getpixel(357,31)==6)
{

17

// AUDIENCE

hidemouseptr();
floodfill(342,50,14);
showmouseptr();
do{getmousepos(&button,&x,&y);

}while(((x-385.00)*(x-385.00)/2025.00)+((y-50.00)*(y50.00)/900.00)<1.00&&(button&1)!=1&&kbhit()==0);
setfillstyle(1,6);
hidemouseptr();
floodfill(342,50,14);
showmouseptr();
setfillstyle(1,12);
}
}
}
user_cho1=getch();
JUMP1:
if(user_cho1=='I'||user_cho1=='i')
{
setcolor(1);
setfillstyle(1,1);
bar(21,95,475,295);
setcolor(14);
line(21,105,475,105);
outtextxy(150,91,"->:COMMUNICATION SCREEN:<-");
instructions();
setcolor(1);
setfillstyle(1,1);
bar(21,95,475,295);
setcolor(14);
line(21,105,475,105);
outtextxy(150,91,"->:COMMUNICATION SCREEN:<-");
goto WRONG1;
}
if(user_cho1=='q'||user_cho1=='Q')
goto quit;
if(user_cho1=='f'||user_cho1=='F')
{
outtextxy(50,150,"YOU ARE USING THIS LIFE LINE");
delay(1000);
setcolor(1);
setfillstyle(1,1);
bar(21,106,475,295);
setcolor(14);
goto WRONG1;
}
if(user_cho1=='P'||user_cho1=='p')
{
if(phone_life==0)
{
setcolor(1);
setfillstyle(1,1);
bar(21,106,475,295);
setcolor(14);

18

if(mouseflag==0)
hidemouseptr();
phone_af_50();
phone_life=1;
setlinestyle(0,0,3);
setcolor(4);
line(200,20,290,80);
line(200,80,290,20);
if(mouseflag==0)
showmouseptr();
setcolor(1);
setfillstyle(1,1);
bar(21,106,475,295);
setcolor(14);
setlinestyle(0,0,1);
goto WRONG1;
}
if(ques_no>5&&ques_no<11)
{
ofstream o1;
f1.open("norm_que",ios::in);
o1.open("temp",ios::trunc);
for( d=1;d<selection_no;d++)
{
f1.read((char*)&q1,sizeof(q1));
o1.write((char*)&q1,sizeof(q1));
}
f1.read((char*)&q1,sizeof(q1));
for(d=selection_no+1;d<=file_length;d++)
{
f1.read((char*)&q1,sizeof(q1));
o1.write((char*)&q1,sizeof(q1));
}
f1.close();
o1.close();
f1.open("temp",ios::in);
o1.open("norm_que",ios::trunc);
f1.read((char*)&q1,sizeof(q1));
while(f1)
{
o1.write((char*)&q1,sizeof(q1));
f1.read((char*)&q1,sizeof(q1));
}
f1.close();
o1.close();
}
quit:
initgraph(&gdriver,&gmode,"\\tc\\bgi");
setcolor(14);
settextstyle(7,0,6);
if(ques_no==1)
{
outtextxy(50,135," Thank you ");
outtextxy(250,185,"for");
outtextxy(90,245,"Playing with us");

19

p1.win=0;
}
if(ques_no>1)
{
outtextxy(90,135,"Congratulations");
outtextxy(250,185,"for");
}
switch(ques_no)
{
case 2:outtextxy(190,245,"Rs 1000");
p1.win=1000;
break;
case 3:outtextxy(190,245,"Rs 2000");
p1.win=2000;
break;
case 4:outtextxy(190,245,"Rs 3000");
p1.win=3000;
break;
case 5:outtextxy(190,245,"Rs 5000");
p1.win=5000;
break;
case 6:outtextxy(180,245,"Rs 10000");
p1.win=10000;
break;
case 7:outtextxy(180,245,"Rs 20000");
p1.win=20000;
break;
case 8:outtextxy(180,245,"Rs 40000");
p1.win=40000;
break;
case 9:outtextxy(180,245,"Rs 80000");
p1.win=80000;
break;
case 10:outtextxy(170,245,"Rs 160000");
p1.win=160000;
break;
case 11:outtextxy(170,245,"Rs 320000");
p1.win=320000;
break;
case 12:outtextxy(170,245,"Rs 640000");
p1.win=640000;
break;
case 13:outtextxy(150,245,"Rs 1250000");
p1.win=1250000;
break;
case 14:outtextxy(150,245,"Rs 2500000");
p1.win=2500000;
break;
case 15:outtextxy(150,245,"Rs 5000000");
p1.win=5000000;
break;
case 16:outtextxy(130,245,"Rs 10000000");
p1.win=10000000;
break;
}
randomize();

20

settextstyle(2,0,1);
for( i=0;i<10000;i++)
{
X=rand()%640;
Y=rand()%480;
Color=rand()%15;
setcolor(Color);
outtextxy(X,Y,".");
}
setcolor(14);
settextstyle(2,0,5);
outtextxy(390,400,"Made By: Harpreet Singh Anand");
outtextxy(390,415,"
( Harry Anand)");
outtextxy(390,440,"Any Recommendation/Problem");
outtextxy(390,460,"Contact:[email protected]");
getch();
closegraph();
o1.open("customer",ios::ate);
o1.write((char*)&p1,sizeof(p1));
o1.close();
end:
_exit();
}

21

Outputs:-

Starting screenshot

22

When enter choice 1:-

23

When enter choice 0:-

24

You might also like