0% found this document useful (0 votes)
23 views72 pages

Uploads Files ButtonDetails 25228

The document describes a student project on simulating the game show Kaun Banega Crorepati. It provides details on the game rules, hardware and software requirements, header files and functions used in the C++ code. The output of the simulation is also described.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views72 pages

Uploads Files ButtonDetails 25228

The document describes a student project on simulating the game show Kaun Banega Crorepati. It provides details on the game rules, hardware and software requirements, header files and functions used in the C++ code. The output of the simulation is also described.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

GOVERNMENT DEGREE COLLEGE

HAYATHNAGAR Dist: RANGAREDDY


(Affiliated to Osmania University)

STUDENT STUDY PROJECT


ON

Kaun Banega Crorepati


Simulation
DEPARTMENT OF COMPUTER SCIENCE
PRESENTED BY
STUDENTS
B.SC III YEAR (COMPUTER SCIENCE)
1. B Venkatesh
2. P Venkata Subramanyam
3. P Jwalitha
4. T Susmitha
5. Y Susma

Under the Guidance of


Dr.G.RAJITHA DEVI
Asst.Professor in Computer Science.
GOVERNMENT DEGREE COLLEGE HAYATHNAGAR
(DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that the project work entitled “Kaun Banega Crorepati
Simulation” using CPP is presented by B.SC (COMPUTER SCIENCE)
STUDENTS in partial fulfillment of the requirements for the degree of Bachelor

of Science in Computer science by the Osmania University, Hyderabad during


the academic year 2019-20.

The results embodied in this report have not been to any other University
or Institution for the award of any degree.

Dr.GURRAM RAJITHA DEVI


Asst.Prof in Computer Science

Head of the Department


ACKNOWLEDGEMENT

I sincerely take it as a privilege to thank the management of our


college GOVENMENTT DEGREE COLLEGE, HAYATHNAGAR for providing
required facilities during our Project.

I derive my great pleasure in expressing our sincere gratitude to our


Principal Dr.B.RAJA RAM for his timely suggestions, which helped us to
complete the Project successfully.

I take it as a privilege to thank our guide Dr.GURRAM RAJITHA


DEVI Asst.Professor in Computer Science Department, for the ideas that
led to complete the Project and we also thank him for continuous guidance,
support and unfailing patience, throughout the course of this work. Her
valuable comments during this period have been valuable and worth for a
lifetime.
It is very auspicious moment we would like to express our gratitude to
Smt.RAJITHA DEVI, our beloved, Lecturer. in Computer Science for his
consistent encouragement during the progress of this Project.

I also thankful to both teaching and non-teaching staff of Computer


Science Department for their kind co-operation and all sorts of help bringing
out this Project successfully.
DECLARATION

I hereby declare that the project report entitled “Kaun Banega Crorepati

Simulation” using “CPP PROGRAMMING” is the work done by us in the

campus at GOVT DEGREE COLLEGE, HAYATHNAGAR during the

academic year 2019-20 and is submitted in partial fulfillment of the

requirements for the degree of Bachelor of science in Maths Physics and

Computer science (MPCs) by the Osmania University, Hyderabad.


CONTENTS

S. No. Title Pg. No.


1. Introduction 1

2 Research Methodology 2

3. Aims And Objectives 3

4. Game Rules 4

5. Hardware and Software Requirements 5

6. Header Files used 6

7. Functions used 7-8


8. Source Code 9-51

9 Output 52-65

10 Conclusion 66

11 Bibliography 67
INTRODUCTION:
KAUN BANEGA CROREPATI PROGRAMME is well famous and
popular game among many players all over the world. This report
details the development of a Kaun Banega Crorepati Simulation
Game application that is written in CPP Programming. In addition, the
report details the implementation to solve any kind of Quiz Game.
Also, how to generate a Game with different level of difficulties and
make sure there will be only one solution. The aim of the report is also
to discuss and other logics in order to create and solve Quiz Game.
Furthermore, the user-friendly environment is considered in the report
as the rules of Kaun Banega Crorepati are connected to the interface.
This programme improves methods of solving Quiz .The report
concludes by evaluating the end application to analyze how good it
met its objectives and the performance of Kaun Banega Crorepati
Simulation Game. Finally, the report summaries the overall
achievements of the application development and indicates other
possible extensions.Kaun Banega Crorepati (KBC) simulation system
is based on the television show by the same name, hosted by Mr.
Amitabh Bachchan. The main objective of this application is to provide
its users with an opportunity to play the famous quizzing game at the
comfort of their homes on a computer system. The main purpose of
this game is to make people learn new things and improve their
general knowledge, just by playing a game. You keep yourself updated
by recent current affairs. There is a good scope for improving one’s
general knowledge. You can be one step ahead of others. You can be
more confident on any topic and gain more knowledge and also able
to convey the information to others as you already know about it. By
this projects students will Acquire knowledge for developing many
more projects like KBC.

1
Research Methodology:

In order to run the program users have to first give the proper
path of the graphics driver which is available under bgi. To
check the whether graphics driver is available or not, you have
to quit the turbo C++ shell and you will be taken to the
C:\TURBOC3\BIN. You will have to change the directory to
check whether bgi driver is available or not. So you can change
directory by CD... and press enter. The directory of bgi can be
different as per the compiler you are using. This is the path of
the graphics driver which we have to give in this program to
enjoy the game.

To start this game, you have to press any key, you will be given
a question with 4 options which has been displayed at the
bottom of the page. A table with the amount is displayed at the
right side of the page, 3 Life lines are displayed at the top right
corner. For every right option you will be promoted to the next
level and you will awarded with some money. In case the player
is stuck with a question he can use any of his life lines. If the
player chooses the wrong option the game ends.

2
PROJECT AIMS AND OBJECTIVES:

KBC GAME involves enhancing skills such as developing


research skills, improving language skills and reasoning
ability, developing the power of concentration and increasing
creative abilities. KBC GAMES Improve IQ Research states
that solving Questions helps raise the IQ (intelligence
quotient) level of the player. KBC GAMES force the solver to
think and reason.
KBC GAMES Improve Cognitive Ability in Students, KBC
GAMES enhance their ability to visualize and understand the
whole - part relationship. KBC GAMES Enhance Motor
Skills.KBC GAMES can be used to speed up the learning
process. When players are expected to grasp the objects and
fit them into proper.
This improves programme building abilities using Graphic as
KBC is graphically oriented programme.

KBC is Design to promote a fun way to study and in the


process help improve once General Knowledge .KBC improve
or expanding once knowledge of things.KBC is to encourage
players to look beyond their textual knowledge and establish a
relationship between theory and application of the learnt
concepts.

3
GAME RULES:

Contestant who is in hot seat will be given a Question with


have 4 options.
He has to choose the right option from the 4 options.
The contestant has 3 –Life lines I.e. They are:

❖ 50:50 – The 2 wrong options will be eliminated. The


contestant is left with 2 options of which one is the
correct option.

❖ Phone a Friend: The contestant can make a phone call to


any of his/her friends or relatives and can ask the answer
for the question. The contestant has only 30 seconds to
do this

❖ Audience pole: The contestant can ask the audience and


choose the right answer.

4
Hardware and Software Requirements:

1. Minimum Hardware Requirements


i. Monitor
ii. Keyboard
iii. Mouse
2. Minimum Software Requirements
i. Operating System: Windows XP
ii. Turbo C++
iii. At least 44.0 KB of free space

5
HEADER FILES USED

Filename Description
FSTREAM.H Provides functions for file and We/o handling

CONIO.H Used to create text based UIs

STDIO.H Provides functions with standard We/o


capabilities.
MATH.H Design for Basic mathematical operations

GRAPHIC.H Facilitate graphical operations such as to draw


different shapes, change colors and many more
STRING.H Contains functions with string handling
capabilities
STDLIB.H This header defines several general purpose
functions
DOS.H Contains functions for handling interrupts,
producing sound date and time function etc.

6
Functions used in the program:

Functions Description

Used to play the game rules, levels of the


Void page2():
game, and ask the details of the player.

Used to display 4 options for the


Void page3():
respective Questions.

It is used to display the Question’s ,Which


Void Questions(); are from the Question Bank and that is
embedded in TC\BIN FOLDER
This is used when player has chosen the
Void incorrect1(); wrong option and ends the Game which is
used to check the first option.
This is used when player has chosen the
Void incorrect2(); wrong option and ends the Game which is
used to check the second option.
This is used when player has chosen the
Void incorrect3(); wrong option and ends the Game which is
used to check the third option.
This is used when player has chosen the
Void incorrect4(); wrong option and ends the Game which is
used to check the fourth option.

Void Phone a This function enables the player to seek


friend(); help from his friend within 30 seconds

This function is used for removing two


Void fifty();
options from the given 4 options.
This function is used for representing a
Void audience(); graph in which the ratio of audience
selecting the options as shown.
This function is used, when the player has
chosen a wrong option it displays the
Void sorry();
statement: sorry
Void select();
It enables the user to select his described
option.
Void total prize
This function is used for showing the
money();
amount won by the player.

This function is used for asking the Name


Void ask name();
and place of the player and it also displays
the instructions of the game.

8
SOURCE CODE:

#include<graphics.h>

#include<stdlib.h>

#include<stdio.h>

#include<conio.h>

#include<dos.h>

#include<math.h>

#include<fstream.h>

#include<string.h>

union REGS i,o;

int flag;

int ansbox1=0,ansbox2=0;

int life1=0,life2=0,life3=0,f3=0;

int button, x1,y1;

long double size;

char str[8]={'0'};

char total[10]={'0'};

long double p=500;

ifstream fin;

char correctans[2];

void page2();

void page3();

void line();

void questions();

void incorrect1();

void incorrect2();

9
void incorrect3();

void incorrect4();

void phonefriend();

void fiftyfifty();

void audiencepoll();

void sorry();

void select();

void correct();

void startscreen();

void totalprizemoney();

void music();

void askname();

int offset=0,num;

int prev[15],count=0;

initmouse()

i.x.ax=0;

int86(0x33,&i,&o);

return(o.x.ax);}

void showmouseptr()

i.x.ax=1;

int86(0x33,&i,&o);

10
void hidemouseptr()

i.x.ax=2;

int86(0x33,&i,&o);

void getmousepos(int *button,int *x,int *y)

i.x.ax=3;

int86(0x33,&i,&o);

*button=o.x.bx;

*x=o.x.cx;

*y=o.x.dx;

void main()

{ /* request auto detection */

int gdriver = DETECT, gmode, errorcode;

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "c:\\tc\\bgi");

/* read result of initialization */

errorcode = graphresult();

if (errorcode != grOk) /* an error occurred */

printf("Graphics error: %s\n",grapherrormsg(errorcode));

11
printf("Press any key to halt:");

getch();

exit(1); /* terminate with an error code */

if(initmouse()==0)

closegraph();

restorecrtmode();

//to go back to normal graphics mode or deleting viewport.

printf(" mouse driver not loaded");

exit(1);

startscreen();

p=500;

ansbox1=0,ansbox2=0;

count=0;

life1=0,life2=0,life3=0;

page2();

hidemouseptr();

page3();

closegraph();

restorecrtmode();

12
}

void page2()

cleardevice();

settextstyle(12,0,5);

setcolor(10);

outtextxy(20,10,"PROJECT CODING DEVELOPED BY Dr. G RAJITHA


DEVI");

setlinestyle(1,0,1);

setcolor(BLUE);

setlinestyle(0,0,3);

rectangle(500,5,625,350);

line(0,350,625,350);

setcolor(LIGHTBLUE);

int poly[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};

drawpoly(7,poly);

line(0,390,40,390);line(580,390,620,390);

int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};

drawpoly(7,poly1);

int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};

drawpoly(7,poly2);

int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};

drawpoly(7,poly3);

int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};

line(0, 430,40,430);line(0,465,40,465);

line(585,430,620,430);line(585,465,620,465);

13
drawpoly(7,poly4);

setfillstyle(1,RED);

settextstyle(2,0,0);

fillellipse(525,20,20,10);

fillellipse(565,20,20,10);

fillellipse(605,20,20,10);

setcolor(YELLOW);

outtextxy(510,15,"50:50");

outtextxy(550,15,"PHONE");

outtextxy(589,13,"PUBLIC");

outtextxy(593,18,"vote");

settextstyle(12,0,2);

setcolor(YELLOW);

outtextxy(520,50," 10000000");

setcolor(LIGHTBLUE);

outtextxy(520,70," 5000000");

outtextxy(520,90," 2500000");

outtextxy(520,110," 1250000");

outtextxy(520,130," 640000");

setcolor(YELLOW);

outtextxy(520,150," 320000");

setcolor(LIGHTBLUE);

outtextxy(520,170," 160000");

outtextxy(520,190," 80000");

14
outtextxy(520,210," 40000");

outtextxy(520,230," 20000");

setcolor(YELLOW);

outtextxy(520,250," 10000");

setcolor(LIGHTBLUE);

outtextxy(520,270," 5000");

outtextxy(520,290," 3000");

outtextxy(520,310," 2000");

outtextxy(520,330," 1000");

count=0;

askname();

questions();

getch();

void page3()

cleardevice();

settextstyle(12,0,1);

for(int i=490;i>=200;i--)

setcolor(10);

15
setcolor(10);

setcolor(WHITE);

outtextxy(10,460,"PRESS ANY KEY TO CONTINUE ");

getch();

exit(0);

char proc[]={"PROCESSING........"};

void line()

setlinestyle(0,0,1);

for(int x=0;x<=485;x++)

{ setcolor(LIGHTGRAY);

line(x+10,20,x+10,340);

setcolor(0);

rectangle(0,20,x,340);

line(x+10,20,x+10,340);

setlinestyle(0,0,3);

sleep(1);

void questions()

char question[200];

char ans1[150];

16
char ans2[150];

char ans3[150];

char ans4[150];

int temp=0;

char ch,ch1;

int num=0,ct=0,i=0,t=0;

int randnum[15];

char str[4],co[4],numc[2];

randomize();

fin.open("KBC.txt",ios::binary);

while(!fin.eof())

fin.get(ch);

if(ch=='\n')

t++;

fin.close();

t=t/6;

fin.open("KBC.txt",ios::binary);

settextstyle(COMPLEX_FONT,0,3);

setcolor(RED);

outtextxy(150,310,"LET's PLAY !!!!");

sleep(3);

17
setcolor(BLACK);

outtextxy(150,310,"LET's PLAY !!!!");

while(ct<15)

count=0;

num=random(t);

for(i=0;i<temp;i++)

if(randnum[i]==num)

num=random(t);

i=0;

randnum[temp]=num;

temp++;

fin.seekg(0,ios::beg);

while(!fin.eof())

fin.get(ch);

if(ch=='\n')

count++;

if(count==(6*num))

18
break;

} if(ct>0)

setcolor(RED);

outtextxy(150,310,"NEXT question!!!!");

sleep(3);

setcolor(BLACK);

outtextxy(150,310,"NEXT question!!!!");

fin.getline(question,200,'\n');

fin.getline(ans1,150,'\n');

fin.getline(ans2,150,'\n');

fin.getline(ans3,150,'\n');

fin.getline(ans4,150,'\n');

fin.getline(correctans,2,'\n');

if(strlen(question)>=40||strlen(ans1)>=25||strlen(ans2)>=25||strlen(
ans3)>= 25||strlen(ans4)>=25)

settextstyle(COMPLEX_FONT,0,1);

else

settextstyle(COMPLEX_FONT,0,2);

setcolor(RED);

setcolor(15);

outtextxy(60,375,question);

outtextxy(60,415,ans1);

19
outtextxy(320,415,ans2);

outtextxy(60,445,ans3);

outtextxy(320,445,ans4);

showmouseptr();

if(correctans[0]=='a')

incorrect1();

else if(correctans[0]=='b')

incorrect2();

else if(correctans[0]=='c')

incorrect3();

else if(correctans[0]=='d')

incorrect4();

ct++;

if(ct==15)

20
totalprizemoney();

fin.close();

} void incorrect1()

count++;

showmouseptr();

flag=0;

select();

while(flag==0)

getmousepos(&button,&x1,&y1);

if((button & 1)==1)

if((x1>=0&&x1<=300)&&(y1>=420&&y1<=445))

correct();

else
if((x1>=300&&x1<=585&&y1>=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=
450&&y1<=475)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))

sorry();

} void incorrect2()

{ count++;

showmouseptr();

flag=0;

21
select();

while(flag==0)

getmousepos(&button,&x1,&y1);

if((button & 1)==1)

if((x1>=300&&x1<=585)&&(y1>=420&&y1<=445))

correct();

else if
((x1>=0&&x1<=300&&y1>=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=450
&&y1<=475)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))

sorry();

void incorrect3()

{ count++;

showmouseptr();

flag=0;

select();

while(flag==0)

getmousepos(&button,&x1,&y1);

if((button & 1)==1)

22
{

if((x1>=0&&x1<=300)&&(y1>=450&&y1<=475))

correct();

else
if((x1>=0&&x1<=300&&y1>=420&&y1<=445)||(x1>=300&&x1<=585&&y1>=
420&&y1<=445)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))

sorry();

void incorrect4()

{ count++;

showmouseptr();

flag=0;

select();

while(flag==0)

getmousepos(&button,&x1,&y1);

if((button & 1)==1)

if((x1>=300&&x1<=585)&&(y1>=450&&y1<=475))

correct();

else
if((x1>=0&&x1<=300)&&(y1>=420&&y1<=445)||(x1>=300&&x1<=585&&y1>
=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=450&&y1<=475))

sorry();

23
}

char prevstr[10]={"1000"};

void correct()

hidemouseptr();

flag=1;

p=p*2;

if(p==4000)

p=3000;

if(p==6000)

p=5000;

if(p==1280000)

p=1250000;

ltoa(p,str,10);

sleep(2);

setcolor(BLUE);

setfillstyle(1,YELLOW);

line(0,250,40,250);line(460,250,500,250);

int pol[]={40,250,60,235,460,235,480,250,460,265,60,265,40,250};

fillpoly(7,pol);

setcolor(BLUE);

24
settextstyle(0,0,3);

outtextxy(200,240,str);

settextstyle(0,0,1);

setcolor(WHITE);

setcolor(BLACK);

setfillstyle(1,BLACK);

settextstyle(0,0,1);

if(ansbox2==1)

bar(503,345+ansbox1,622,360+ansbox1);

setcolor(WHITE);

outtextxy(520,350+ansbox1,"");

outtextxy(540,350+ansbox1,prevstr);

setcolor(RED);

ansbox2=1;

setfillstyle(1,RED);

setcolor(WHITE);

settextstyle(0,0,1);

ansbox1=ansbox1-20;

bar(503,345+ansbox1,622,360+ansbox1);

outtextxy(520,350+ansbox1,"");

outtextxy(540,350+ansbox1,str);

ltoa(p,prevstr,10);

25
if(p==10000||p==320000||p==10000000)

music();

sleep(1);

setcolor(BLACK);

setfillstyle(1,BLACK);

bar3d(0,230,495,270,0,1);

settextstyle(COMPLEX_FONT,0,2);

setcolor(RED);

sleep(1);

setcolor(LIGHTBLUE);

setfillstyle(1,BLACK);

int poly[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};

fillpoly(7,poly);

line(0,390,40,390);line(580,390,620,390);

int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};

fillpoly(7,poly1);

int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};

fillpoly(7,poly2);

int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};

fillpoly(7,poly3);

int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};

line(0, 430,40,430);line(0,465,40,465);

line(585,430,620,430);line(585,465,620,465);

fillpoly(7,poly4);

26
}

void sorry()

hidemouseptr();

sleep(1);

setcolor(BLUE);

settextstyle(0,0,3);

outtextxy(50,200,"SORRY ! INCORRECT");

sleep(2);

fin.close();

clearviewport();

setcolor(BLUE);

totalprizemoney();

void totalprizemoney()

hidemouseptr();

clearviewport();

setcolor(BLUE);

setfillstyle(1,YELLOW);

line(0,390,40,390);line(580,390,620,390);

int pol[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};

fillpoly(7,pol);

27
setcolor(RED);

settextstyle(0,0,2);

outtextxy(70,380,"Total prize money:");

setcolor(BLUE);

outtextxy(360,380,str);

settextstyle(0,0,1);

setcolor(GREEN);

outtextxy(100,430,"USE THE KEYBOARD ARROW KEYS TO SELECT");

setfillstyle(1,YELLOW);

bar(80,445,150,460);

char a=0,x='E';int flg=0;

do

outtextxy(100,450,"REPLAY EXIT");

a=getch();

switch(a)

case 13 :

if((flg%2)==0)

x='R';

else

x='E';

break;

case 77:

28
case 7

5:

if((flg%2)==0)

setfillstyle(1,0);

bar(80,445,150,460);

setfillstyle(1,YELLOW);

bar(200,445,270,460);

else

setfillstyle(1,0);

bar(200,445,270,460);

setfillstyle(1,YELLOW);

bar(80,445,150,460);

break;

if(a==75||a==77)

flg++;

}while(a!=13);

if(x=='R')

clearviewport();

29
closegraph();

main();

else if(x=='E')

page3();

closegraph();

exit(0);

void pass(int poly[14])

setfillstyle(1,LIGHTBLUE);

setcolor(LIGHTBLUE);

drawpoly(7,poly);

ellipse(605,20,0,360,20,10);

ellipse(525,20,0,360,20,10);

ellipse(565,20,0,360,20,10);

setfillstyle(1,YELLOW);

setcolor(YELLOW);

void select()

30
int polygon1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};

int
polygon2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};

int polygon3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};

int
polygon4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};

setcolor(RED);

setfillstyle(1,RED);

setlinestyle(1,0,15);

do

settextstyle(3,0,2);

setcolor(BLACK);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

x:

getmousepos(&button,&x1,&y1);

if(x1>=0&&x1<=300&&y1>=420&&y1<=445)

pass(polygon2);

pass(polygon3);

pass(polygon4);

drawpoly(7,polygon1);

else if(x1>=300&&x1<=585&&y1>=420&&y1<=445)

pass(polygon1);

31
pass(polygon3);

pass(polygon4);

drawpoly(7,polygon2);

else if(x1>=0&&x1<=300&&y1>=450&&y1<=475)

pass(polygon1);

pass(polygon2);

pass(polygon4);

drawpoly(7,polygon3);

/*

putimage(50,425,arrow1,1);

putimage(330,425,arrow1,1);

putimage(50,455,arrow,1);

putimage(330,455,arrow1,1);

*/

else if(x1>=300&&x1<=585&&y1>=450&&y1<=475)

pass(polygon1);

pass(polygon3);

pass(polygon2);

drawpoly(7,polygon4);

32
//select lifeline.................................

//50:50

else if(x1>=505&&x1<=545&&y1>=10&&y1<=30)

if(life1==1&&(button &1)==1)

settextstyle(3,0,2);

setcolor(YELLOW);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

goto x;

setcolor(YELLOW);

ellipse(525,20,0,360,20,10);

setcolor(LIGHTBLUE);

ellipse(605,20,0,360,20,10);

ellipse(565,20,0,360,20,10);

fiftyfifty();

goto x;

//Phone a friend

else if(x1>=545&&x1<=585&&y1>=10&&y1<=30)

if(life2==1&&(button &1)==1)

33
{

settextstyle(3,0,2);

setcolor(YELLOW);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

goto x;

setcolor(YELLOW);

ellipse(565,20,0,360,20,10);

setcolor(LIGHTBLUE);

ellipse(605,20,0,360,20,10);

ellipse(525,20,0,360,20,10);

phonefriend();

goto x;

//audience poll

else if(x1>=585&&x1<=625&&y1>=10&&y1<=30)

if(life3==1&&(button &1)==1)

settextstyle(3,0,2);

setcolor(YELLOW);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

goto x;

34
setcolor(YELLOW);

ellipse(605,20,0,360,20,10);

setcolor(LIGHTBLUE);

ellipse(565,20,0,360,20,10);

ellipse(525,20,0,360,20,10);

audiencepoll();

goto x;

while((button & 1)!=1);

void startscreen()

setlinestyle(0,0,3);

setcolor(BLUE);

setfillstyle(1,BLUE);

circle(300,225,225);

floodfill(300,200,BLUE);

setcolor(LIGHTBLUE);

setfillstyle(1,LIGHTBLUE);

circle(300,225,185);

floodfill(300,200,LIGHTBLUE);

35
setcolor(0);

setfillstyle(SLASH_FILL,0);

setlinestyle(1,0,0);

for(int p=0;p<=185;p++)

circle(300,225,p);

delay(10);

setlinestyle(1,0,3);

setcolor(BLUE);

setfillstyle(7,BLUE);

fillellipse(300,225,30,185);

fillellipse(300,225,185,30);

setcolor(BLUE);

setcolor(15);

setfillstyle(1,15);

setcolor(15);

settextstyle(8,0,5);

settextstyle(0,0,3);

outtextxy(100,125,"K");

outtextxy(125,85,"A");

outtextxy(155,55,"U");

outtextxy(195,25,"N");

36
outtextxy(300,10,"B");

outtextxy(350,20,"A");

outtextxy(395,35,"N");

outtextxy(435,65,"E");

outtextxy(465,105,"G");

outtextxy(485,140,"A");

setcolor(YELLOW);

outtextxy(495,180,"-");

outtextxy(85,180,"-");

outtextxy(495,250,"");

outtextxy(85,250,"");

setcolor(15);

outtextxy(100,305,"K");

outtextxy(125,345,"A");

outtextxy(155,375,"U");

outtextxy(195,405,"N");

outtextxy(300,420,"B");

outtextxy(350,415,"A");

outtextxy(395,395,"N");

outtextxy(435,365,"E");

outtextxy(465,335,"G");

outtextxy(485,290,"A");

setlinestyle(1,0,3);

37
setcolor(5);

setfillstyle(0,5);

circle(300,225,185);

settextstyle(12,0,5);

setcolor(10);

outtextxy(510,470,"G RAJITHA DEVI");

setlinestyle(1,0,1);

setcolor(15);

settextstyle(8,0,5);

outtextxy(265,195," E ");

sound(1000);

delay(600);

outtextxy(215,195," R ");

outtextxy(315,195," P ");

sound(1100);

delay(600);

sound(1200);

delay(500);

outtextxy(170,195," O ");

outtextxy(365,195," A ");

sound(1000);

delay(500);

sound(1100);

38
delay(550);

outtextxy(115,195," R ");

outtextxy(400,195," T ");

sound(1200);

delay(450);

sound(1350);

delay(450);

outtextxy(85,195,"C ");

outtextxy(500,195,"I");

sound(1500);

delay(1000);

nosound();

settextstyle(0,0,1);

outtextxy(10,460,"PRESS ANY KEY TO CONTINUE ");

getch();

void music()

sound(1000);

delay(600);

sound(1100);

delay(600);

39
sound(1200);

delay(500);

sound(1000);

delay(500);

sound(1100);

delay(550);

sound(1200);

delay(450);

sound(1350);

delay(450);

sound(1500);

delay(1000);

nosound();

void askname()

settextstyle(0,0,1);

setcolor(7);

outtextxy(0,90,"WELCOME TO THE COMPUTER VERSION OF kaun banega


crorepati");

outtextxy(0,115,"please enter your name : ");

char name[40];

gotoxy(30,8);

cin.getline(name,40);

40
outtextxy(0,150,"please enter your city : ");

char city[40];

gotoxy(30,10);

cin.getline(city,40);

sleep(1);

line();

sleep(1);

setcolor(7);

outtextxy(10,90,"LET'S WELCOME ");

outtextxy(270,110," FROM ");

setcolor(RED);

outtextxy(150,90,name);

outtextxy(320,110,city);

setcolor(LIGHTGREEN);

outtextxy(0,150,"IMPORTANT INSTRUCTIONS ");

sleep(2);

setcolor(LIGHTGRAY);

outtextxy(0,170,"USE THE MOUSE TO PLAY THE GAME. ");

sleep(2);

setcolor(LIGHTGREEN);

outtextxy(0,190,"PLEASE CLICK AND HOLD THE LEFT MOUSE BUTTON TO


SELECT.");

sleep(2);

41
setcolor(LIGHTGRAY);

outtextxy(0,210,"YOU HAVE 3 LIFELINES(AS INDICATED ON THE UPPER


RIGHT CORNER).");

outtextxy(0,230,"CLICK ON THE LIFELINES TO SELECT THEM.");

sleep(2);

outtextxy(0,250,"THE FILE KBC.TXT IS AN EVER EXPANDABLE QUESTION


BANK..");

outtextxy(0,260,"PLEASE STICK ON TO THE FORMAT USED IN THE FILE


WHILE.. ");

outtextxy(100,270,"EXPANDING THE QUESTION BANK" );

setcolor(WHITE);

sleep(2);

settextstyle(0,0,1);

outtextxy(0,320,"PRESS ANY KEY TO CONTINUE ");

getch();

line();

settextstyle(BOLD_FONT,0,1);

void phonefriend()

settextstyle(3,0,2);

setcolor(BLACK);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

if(((button &1)==1)&&life2==0)

42
{

hidemouseptr();

setcolor(LIGHTBLUE);

settextstyle(0,HORIZ_DIR,2);

outtextxy(30,250,"PHONE A FRIEND ....... ");

sleep(1);

outtextxy(30,270,"YOUR TIME STARTS.....NOW ");

sleep(1);

line();

setcolor(LIGHTGRAY);

setfillstyle(2,RED);

circle(300,200,100);

char arc[10];

settextstyle(0,HORIZ_DIR,5);

int x=0;

setfillstyle(1,DARKGRAY);

for(int i=0;i<=30;i++)

setcolor(BLACK);

pieslice(300,200,0,i*12,97);

itoa(i,arc,10);

setcolor(BLUE);

if(i>=10)

43
x=25;

outtextxy(280-x,180,arc);

sleep(1);

setcolor(BLACK);

outtextxy(280-x,180,arc);

life2=1;

setcolor(YELLOW);

settextstyle(3,HORIZ_DIR,3);

outtextxy(0,315,"YOUR TIME ENDS HERE.CLICK AN ANSWER");

sleep(3);

line();

showmouseptr();

void fiftyfifty()

settextstyle(3,0,2);

setcolor(BLACK);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

randomize();

int r1=0,r2=0;

44
if(((button &1)==1)&&life1==0)

setcolor(LIGHTBLUE);

settextstyle(0,HORIZ_DIR,2);

outtextxy(30,250,"50:50 LIFELINE ");

sleep(1);

outtextxy(0,270,"TWO WRONG CHOICES WILL");

outtextxy(280,290,"BE ELIMINATED");

sleep(1);

line();

if(correctans[0]=='a')

while(r1==0||r2==0||r1==r2)

r1=random(4);

r2=random(4);

if(correctans[0]=='b')

while(r1==1||r2==1||r1==r2)

r1=random(4);

r2=random(4);

45
}

if(correctans[0]=='c')

while(r1==2||r2==2||r1==r2)

r1=random(4);

r2=random(4);

if(correctans[0]=='d')

while(r1==3||r2==3||r1==r2)

r1=random(4);

r2=random(4);

setcolor(BLACK);

setfillstyle(1,BLACK);

int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};

int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};

int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};

int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};

46
if(r1==0)

fillpoly(7,poly1);

else if(r1==1)

fillpoly(7,poly2);

else if(r1==2)

fillpoly(7,poly3);

else if(r1==3)

fillpoly(7,poly4);

if(r2==0)

fillpoly(7,poly1);

else if(r2==1)

fillpoly(7,poly2);

else if(r2==2)

fillpoly(7,poly3);

else if(r2==3)

fillpoly(7,poly4);

life1=1;

void audiencepoll()

settextstyle(3,0,2);

setcolor(BLACK);

outtextxy(30,270,"LIFELINE TAKEN ALREADY");

47
randomize();

int r1=0,r2=0,r3=0,r4=0;

if(((button &1)==1)&&life3==0)

hidemouseptr();

setcolor(LIGHTBLUE);

settextstyle(0,HORIZ_DIR,2);

outtextxy(30,250,"AUDIENCE POLL ");

sleep(2);

line();

if(correctans[0]=='a')

while(r1<r2||r1<r3||r1<r4||r1+r2+r3+r4!=100)

r1=random(100);

r2=random(100);

r3=random(100);

r4=random(100);

else if(correctans[0]=='b')

while(r2<r1||r2<r3||r2<r4||r1+r2+r3+r4!=100)

48
r1=random(100);

r2=random(100);

r3=random(100);

r4=random(100);

else if(correctans[0]=='c')

while(r3<r1||r3<r2||r3<r4||r1+r2+r3+r4!=100)

r1=random(100);

r2=random(100);

r3=random(100);

r4=random(100);

else if(correctans[0]=='d')

while(r4<r1||r4<r2||r4<r3||r1+r2+r3+r4!=100)

r1=random(100);

r2=random(100);

r3=random(100);

r4=random(100);

49
}

char r11[20];

char r22[20];char r33[20];char r44[20];

itoa(r1,r11,10);

itoa(r2,r22,10);

itoa(r3,r33,10);

itoa(r4,r44,10);

setcolor(YELLOW);

bar(240,150-r1,260,150);

bar(265,150-r2,280,150);

bar(285,150-r3,300,150);

bar(305,150-r4,320,150);

settextstyle(0,0,1);

setcolor(GREEN);

outtextxy(240,152,"A B C D");

outtextxy(240,140-r1,r11);

outtextxy(265,140-r2,r22);

outtextxy(285,140-r3,r33);

outtextxy(305,140-r4,r44);

setcolor(RED);

rectangle(230,30,330,175);

life3=1;

f3=1;

setcolor(YELLOW);

50
settextstyle(1,0,2);

outtextxy(0,250,"Press any key on the keyboard to continue..");

showmouseptr();

getch();

line();

51
OUTPUT SCREENS:

52
65
Conclusion and Suggestions:

This section concludes the report with what have been


achieved. In addition, it discusses future activities that could be
added to the application. In future we can implement it by timer
at each every level of the game.

66
REFERENCES:
1. B. Lippman, C++ Primer
2. Bruce Eckel, Thinking in C++
3. K.R.Venugopal, Mastering C++
4. Herbert Schildt, C++: The Complete Reference
5. BjarneStroustrup, The C++ Programming Language ,Object Oriented
Programming with c++.

67

You might also like