Kaun banega Crorepati
//*************************************************************************////*************************************************************************//
// -*- "Program For Game of K.B.C." -*- //
//-------------------------------------------------------------------------//
// -*- Language :- C-Graphics & C++. -*- //
//-------------------------------------------------------------------------//
// -*- Compilier :- Turbo C & C++. -*- //
//-------------------------------------------------------------------------//
// -*- By- Vikrantsingh Bisen. -*- //
//*************************************************************************//
//*************************************************************************//
//*************************************************//
// -*- Including Header File -*- //
//*************************************************//
#include<iostream.h>
#include<graphics.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
#include<dos.h>
//****************************************//
// -*- CLASS FOR ATTRACTIVE LOOK -*- //
//****************************************//
class Display
{
private:
int i,j;
public:
void rect(int,int,int,int);
Display();
void boxes();
void start();
};
void Display::start()
{
cleardevice();
setbkcolor(BLACK);
setcolor(RED);
for(i=0;i<640;i++)
line(i,0,i,500);
for(i=320,j=320;i>=50;i--,j++)
{
setcolor(0);
line(i,0,i,500);line(j,0,j,500);
delay(15);
}
setcolor(MAGENTA);
j=200;i=7;
settextstyle(1,HORIZ_DIR,i);
outtextxy(j,100," K ");
delay(250);
outtextxy(j,100," Ka ");
delay(250);
outtextxy(j,100," Kau ");
delay(250);
outtextxy(j,100," Kaun ");
delay(250);
outtextxy(j,175,"B ");
delay(250);
outtextxy(j,175,"Ba ");
delay(250);
outtextxy(j,175,"Ban ");
delay(250);
outtextxy(j,175,"Bane ");
delay(250);
outtextxy(j,175,"Baneg ");
delay(250);
outtextxy(j,175,"Banega ");
delay(250);
j=135;
outtextxy(j,250," C");
delay(250);
outtextxy(j,250," Cr");
delay(250);
outtextxy(j,250," Cro");
delay(250);
outtextxy(j,250," Cror");
delay(250);
outtextxy(j,250," Crore");
delay(250);
outtextxy(j,250," Crorep");
delay(250);
outtextxy(j,250," Crorepa");
delay(250);
outtextxy(j,250," Crorepat");
delay(250);
outtextxy(j,250," Crorepati");
delay(250);
outtextxy(240,330,"...?... ");
settextstyle(7,HORIZ_DIR,3);
outtextxy(110,400,"Designed by :- Vikrantsingh Bisen.");
setcolor(YELLOW);
settextstyle(7,HORIZ_DIR,1);
for(i=0;i<450;i+=20)
{
outtextxy(80,i,"$");
outtextxy(550,i,"$");
delay(205);
}
getch();
setcolor(CYAN);
for(i=0;i<320;i+=5)
{
delay(20);
line(i,0,i,500);
line(638-i,0,638-i,500);
}
//exit(0);
cleardevice();
setbkcolor(0);
}
void Display::rect(int i,int j,int k,int l)
{
setcolor(WHITE);
line(i,j,k,j);
line(i,j,i,l);
setcolor(DARKGRAY);
line(i,l,k,l); //Draw 3D Rectangle
//line(i-1,l-1,k-1,l-1);
line(k,j,k,l);
//line(k-1,j-1,k-1,l-1);
}
void Display::Display()
{
setcolor(LIGHTCYAN);
rectangle(1,2,638,474);
rectangle(5,6,634,206);
rectangle(5,210,634,470); //Display Border.
setcolor(YELLOW);
rectangle(3,4,636,208);
rectangle(3,208,636,472);
setcolor(LIGHTMAGENTA);
line(21,21,618,21);
line(21,21,21,194);
setcolor(LIGHTMAGENTA);
line(618,21,618,194);
line(21,194,618,194);
}
void Display::boxes()
{ //Big Box
line(120,250,510,250);
line(120,300,510,300);
line(120,250,60,275);
line(120,300,60,275);
line(510,250,570,275);
line(510,300,570,275);
line(6,275,60,275);
line(570,275,633,275);
// A Box
line(120,330,225,330);
line(120,370,225,370);
line(120,330,60,350);
line(120,370,60,350);
line(225,330,285,350);
line(225,370,285,350);
line(6,350,60,350);
line(285,350,335,350);
// B Box
line(120,400,225,400);
line(120,440,225,440);
line(120,400,60,420);
line(120,440,60,420);
line(225,400,285,420);
line(225,440,285,420);
line(6,420,60,420);
line(285,420,335,420);
// C Box
line(395,330,510,330);
line(395,370,510,370);
line(395,330,335,350);
line(395,370,335,350);
line(510,330,570,350);
line(510,370,570,350);
line(570,350,633,350);
// d Box
line(395,400,510,400);
line(395,440,510,440);
line(395,400,335,420);
line(395,440,335,420);
line(510,400,570,420);
line(510,440,570,420);
line(570,420,633,420);
}
/*------------ -*- END OF CLASS DISPLAY -*- ------------------------------*/
//****************************************//
// -*- CLASS TO PUT TEXT -*- //
//****************************************//
class Text:public Display
{
private:
int i,j;
public:
void put_name();
void put_levels();
void put_lifeline();
void refresh();
};
void Text::put_name()
{
settextstyle(4,HORIZ_DIR,6);
setcolor(LIGHTGREEN);
outtextxy(46,30,"Kaun Banega");
outtextxy(46,80,"Crorepati...........?");
}
void Text::put_levels()
{
settextstyle(11,HORIZ_DIR,1);
setcolor(GREEN);
outtextxy(500,35,"1,00,00,000");
setcolor(YELLOW);
outtextxy(500,45," 50,00,000");
outtextxy(500,55," 25,00,000");
outtextxy(500,65," 12,00,000");
outtextxy(500,75," 6,50,000");
setcolor(GREEN);
outtextxy(500,85," 3,20,000");
setcolor(YELLOW);
outtextxy(500,95," 1,60,000");
outtextxy(500,105," 80,000");
outtextxy(500,115," 40,000");
outtextxy(500,125," 20,000");
setcolor(GREEN);
outtextxy(500,135," 10,000");
setcolor(YELLOW);
outtextxy(500,145," 5,000");
outtextxy(500,155," 3,000");
outtextxy(500,165," 2,000");
outtextxy(500,175," 1,000");
rectangle(490,30,605,185);
}
void Text::put_lifeline()
{
for(i=80;i<380;i+=120)rect(i,160,i+100,185);
settextstyle(11,HORIZ_DIR,1);
setcolor(LIGHTRED);
outtextxy(90,168,"1.Restart");
outtextxy(206,168,"2.Life Line");
outtextxy(325,168,"3. QUIT");
}
void Text::refresh()
{
cleardevice();
Display();
boxes();
put_name();
put_levels();
put_lifeline();
}
/*------------ -*- END OF CLASS TEXT -*- ------------------------------*/
//***********************************************************//
// -*- CLASS TO PUT QUESTION AND CHECK ANSWER -*- //
//***********************************************************//
class question:public Text
{
int qu_no,i,j,k,question[15],answer,aud_vote,f_50;
public:
question();
void put_ques(int=0);
void check_ans(int);
void show_level();
void options(int);
};
void question::question()
{
qu_no=-1;
j=1;
k=0;
i=0;
aud_vote=1;
f_50=1;
}
void question::put_ques(int p)
{
outtextxy(120,270," Please! Wait...........");
if(p==0)
{
qu_no++;
//show_level();
while(j)
{
randomize();
k=random(31);
question[qu_no]=k;
for(i=0;i<qu_no;i++)
{
if(k==question[i])
{
break;
}
}
if(i==qu_no)
j=0;
else
j=1;
}
}
//else k=p;
j=1;
refresh();
show_level();
setcolor(LIGHTCYAN);
settextstyle(11,HORIZ_DIR,1);
switch(k)
{
case 0 :
outtextxy(120,270,"Q.Who is the President of U.S.A ?");
outtextxy(120,345,"A] J.W.Bush. ");
outtextxy(120,415,"B] B.Obama. "); //
outtextxy(395,345,"C] Bill Clinton. ");
outtextxy(395,415,"D] k.j.william. ");
answer= 2;
break;
case 1 :
outtextxy(120,270,"Q.Whis of the following is not a Spices?");
outtextxy(120,345,"A] Saffron. ");
outtextxy(120,415,"B] Betel-nut. ");
outtextxy(395,345,"C] Turmeric. ");
outtextxy(395,415,"D] Almond. "); //
answer= 4;
break;
case 2 :
outtextxy(120,270,"Q.Whis of the following is not a Bird ?");
outtextxy(120,345,"A] Kite. ");
outtextxy(120,415,"B] Swan. ");
outtextxy(395,345,"C] Bat. ");
outtextxy(395,415,"D] Fawn. "); //
answer= 4;
break;
case 3 :
outtextxy(120,270,"Q.Which is the fifth planet from the Sun ?");
outtextxy(120,345,"A] Jupiter. "); //
outtextxy(120,415,"B] Saturn. ");
outtextxy(395,345,"C] Neptune. ");
outtextxy(395,415,"D] Mars. ");
answer= 1;
break;
case 4 :
outtextxy(120,270,"Q.River Krishna meets ___ Ocean ?");
outtextxy(120,345,"A] Arabian Sea. ");
outtextxy(120,415,"B] Bay of Bengal. ");
outtextxy(395,345,"C] Indian Ocean. ");
outtextxy(395,415,"D] None. ");
answer= 2;
break;
case 5 :
outtextxy(120,270,"Q.Which of the following is not a unit of lenght ?");
outtextxy(120,345,"A] Light year. ");
outtextxy(120,415,"B] Meter. ");
outtextxy(395,345,"C] Mile. ");
outtextxy(395,415,"D] Solar orbit unit. "); //
answer= 4;
break;
case 6 :
outtextxy(120,270,"Q.__ is used to measure the Humidity in air ?");
outtextxy(120,345,"A] Humidometer. ");
outtextxy(120,415,"B] Hygrometer. "); //
outtextxy(395,345,"C] Hydrometer. ");
outtextxy(395,415,"D] Thermometer. ");
answer=2;
break;
case 7 :
outtextxy(120,270,"Q.Which company makes walkman phone ?");
outtextxy(120,345,"A] Nokia. ");
outtextxy(120,415,"B] Atom. ");
outtextxy(395,345,"C] Motorola. ");
outtextxy(395,415,"D] Sony Ericsson. "); ///
answer= 4;
break;
case 8 :
outtextxy(120,270,"Q.Which of the following is called Big Blue ?");
outtextxy(120,345,"A] IBM. "); //
outtextxy(120,415,"B] HP. ");
outtextxy(395,345,"C] DELL. ");
outtextxy(395,415,"D] BBC. ");
answer=1;
break;
case 9 :
outtextxy(120,270,"Q.Which of the following is not a computer language ?");
outtextxy(120,345,"A] XML. ");
outtextxy(120,415,"B] AS400. ");
outtextxy(395,345,"C] XSTL. ");
outtextxy(395,415,"D] CSL. "); //
answer= 4;
break;
case 10 :
outtextxy(120,262,"Q.What is the `Error 400'which is seen sometime -");
outtextxy(120,278," while browsing th net ?");
outtextxy(112,345,"A] Request Time Out. ");
outtextxy(108,412,"B] Request denied - ");
outtextxy(108,420,"due to syntax error. "); //
outtextxy(381,345,"C] Password Protected. ");
outtextxy(386,415,"D] Bad file request. ");
answer= 2;
break;
case 11 :
outtextxy(120,270,"Q.Google's image editing software is __ ?");
outtextxy(120,345,"A] Photobucket. ");
outtextxy(120,415,"B] Photoshop. ");
outtextxy(395,345,"C] Flicker. ");
outtextxy(395,415,"D] Picasa. "); //
answer= 4;
break;
case 12 :
outtextxy(120,270,"Q.Who wrote the book -`...Gitanjali'");
outtextxy(120,345,"A] R.Tagore. ");
outtextxy(120,415,"B] M.Gandhi. ");
outtextxy(395,345,"C] Vivekanand. ");
outtextxy(395,415,"D] None. ");
answer= 1;
break;
case 13 :
outtextxy(120,270,"Q.I.S.R.O. was Formed in the year__ ?");
outtextxy(120,345,"A] 1949. ");
outtextxy(120,415,"B] 1959. ");
outtextxy(395,345,"C] 1969. "); //
outtextxy(395,415,"D] 1979. ");
answer= 3;
break;
case 14 :
outtextxy(120,270,"Q.C & C++ language is developed in the year__ ?");
outtextxy(120,345,"A] 1972 & 1980's."); //
outtextxy(120,415,"B] 1982 & 1990's.");
outtextxy(395,345,"C] 1962 & 1970's.");
outtextxy(395,415,"D] 1952 & 1960's.");
answer= 1;
break;
case 15 :
outtextxy(120,270,"Q.`Moon blindness' is due to deficiency of__?");
outtextxy(120,345,"A] Vitamin A. "); //
outtextxy(120,415,"B] Vitamin B. ");
outtextxy(395,345,"C] Vitamin C. ");
outtextxy(395,415,"D] Vitamin D. ");
answer= 1;
break;
case 16 :
outtextxy(120,270,"Q.How many bones are there in human body ?");
outtextxy(120,345,"A] 106.");
outtextxy(120,415,"B] 156.");
outtextxy(395,345,"C] 206."); //
outtextxy(395,415,"D] 256.");
answer= 3;
break;
case 17 :
outtextxy(120,270,"Q.Jamshedpur is in ?");
outtextxy(120,345,"A] M.P.");
outtextxy(120,415,"B] Jharkhand."); //
outtextxy(395,345,"C] Bihar.");
outtextxy(395,415,"D] Chhattisgrah.");
answer= 2;
break;
case 18 :
outtextxy(120,270,"Q.The first ATM was introduced by _?_ Bank. ");
outtextxy(120,345,"A] Citibank.");
outtextxy(120,415,"B] Barclays Bank."); //
outtextxy(395,345,"C] R.B.I.");
outtextxy(395,415,"D] U.S.B.");
answer= 2;
break;
case 19 :
outtextxy(120,262,"Q.__ state account for 60% of India's ?");
outtextxy(120,278," total chillies production ?");
outtextxy(120,345,"A] M.P.");
outtextxy(120,415,"B] H.P.");
outtextxy(395,345,"C] A.P.");
outtextxy(395,415,"D] None.");
answer= 3;
break;
case 20 :
outtextxy(120,270,"Q.Mother Day is celebrated on ?");
outtextxy(120,345,"A] 2nd May."); //Mot
outtextxy(120,415,"B] 3rd June."); //Fth
outtextxy(395,345,"C] 1st Aug."); //Frd
outtextxy(395,415,"D] 7th April."); //health
answer= 1;
break;
case 21 :
outtextxy(120,270,"Q.Paper aniversary is celebrated after__ ?");
outtextxy(120,345,"A] 1 Year."); //
outtextxy(120,415,"B] 2 Year.");
outtextxy(395,345,"C] 3 Year.");
outtextxy(395,415,"D] 4 Year.");
answer= 1;
break;
case 22 :
outtextxy(120,270,"Q.How many men of India's armed forces retire every year?");
outtextxy(120,345,"A] 20,000.");
outtextxy(120,415,"B] 60,000."); //
outtextxy(395,345,"C] 1,00,000.");
outtextxy(395,415,"D] 2,00,000.");
answer= 2;
break;
case 23 :
outtextxy(120,270,"Q.Britian's grestest industrial centre is__?");
outtextxy(120,345,"A] London Purchase.");
outtextxy(120,415,"B] W.T.C.");
outtextxy(385,345,"C] Loisiana Purchase.."); //
outtextxy(395,415,"D] Paris Central.");
answer= 3;
break;
case 24 :
outtextxy(120,270,"Q.E.M.I in banking stands for ?");
outtextxy(90,345,"A] Easy monthly Inst..");
outtextxy(90,415,"B] Equated monthly Inst.."); //
outtextxy(360,345,"C] Early monthly Inst..");
outtextxy(395,415,"D] None.");
answer= 2;
break;
case 25 :
outtextxy(120,270,"Q.`Nepal Army' was formaly known as__ ?");
outtextxy(120,345,"A] Indo Nepal Army.");
outtextxy(120,415,"B] King Nepal Army.");
outtextxy(395,345,"C] Rolay Nepal Army."); //
outtextxy(395,415,"D] None.");
answer= 3;
break;
case 26 :
outtextxy(120,270,"Q.How is known as `Honest Abe' ?");
outtextxy(120,345,"A] Abraham Lincoln."); //
outtextxy(120,415,"B] M.Gandhi.");
outtextxy(395,345,"C] J.W.Bush");
outtextxy(395,415,"D] None.");
answer= 1;
break;
case 27 :
outtextxy(120,270,"Q.Rahul Drawid'd middle name?");
outtextxy(120,345,"A] Vijaykumar.");
outtextxy(120,415,"B] Shivkumar.");
outtextxy(395,345,"C] Sharad."); //
outtextxy(395,415,"D] Venkatesh.");
answer= 3;
break;
case 28 :
outtextxy(120,270,"Q.India's largest housing financing company ?");
outtextxy(120,345,"A] S.B.I.");
outtextxy(120,415,"B] I.C.I.C.I.");
outtextxy(395,345,"C] H.D.F.C."); //
outtextxy(395,415,"D] M.F.");
answer= 3;
break;
case 29 :
outtextxy(120,270,"Q.Somnath Chatterjee was/is a ?");
outtextxy(120,345,"A] Presedent.");
outtextxy(120,415,"B] Speaker."); //
outtextxy(395,345,"C] M.L.A.");
outtextxy(395,415,"D] Magistrate.");
answer= 2;
break;
case 30 :
outtextxy(120,270,"Q.First CD was developed by company__ ?");
outtextxy(120,345,"A] Philips.");//
outtextxy(120,415,"B] Moser Baer.");
outtextxy(395,345,"C] Samsung.");
outtextxy(395,415,"D] None.");
answer= 1;
break;
}
}
void question::check_ans(int choice)
{
refresh();
if(choice==answer)
{
outtextxy(190,255,"CONGRATULATION! You have own");
gotoxy(35,18);
switch(qu_no)
{
case 0:
cout<<"Rs.1,000/-";
break;
case 1:
cout<<"Rs.2,000/-";
break;
case 2:
cout<<"Rs.3,000/-";
break;
case 3:
cout<<"Rs.5,000/-";
break;
case 4:
cout<<"Rs.10,000/-";
break;
case 5:
cout<<"Rs.20,000/-";
break;
case 6:
cout<<"Rs.40,000/-";
break;
case 7:
cout<<"Rs.80,000/-";
break;
case 8:
cout<<"Rs.1,60,000/-";
break;
case 9:
cout<<"Rs.3,20,000/-";
break;
case 10:
cout<<"Rs.6,40,000/-";
break;
case 11:
cout<<"Rs.12,50,000/-";
break;
case 12:
cout<<"Rs.25,00,000/-";
break;
case 13:
cout<<"Rs.50,00,000/-";
break;
case 14:
cout<<"Rs.1,00,00,000/-";
getch();
getch();
for(i=0;i<320;i+=5)
{
delay(20);
line(i,0,i,500);
line(638-i,0,638-i,500);
}
exit(0);
break;
}
}
else
{
outtextxy(145,258,"SORRY! Your Answer is wrong,You have won only");
gotoxy(35,18);
if(qu_no<5)
cout<<"Rs."<<"0/-";
else if(qu_no<10)
cout<<"Rs."<<"10,000/-";
else
cout<<"Rs."<<"3,20,000/-";
getch();
getch();
for(i=0;i<320;i+=5)
{
delay(20);
line(i,0,i,500);
line(638-i,0,638-i,500);
}
exit(0);
}
getch();
refresh();
}
void question::show_level()
{
for(i=0;i<qu_no;i++)
{
setcolor(LIGHTGREEN);
outtextxy(592,175-(i*10),"*");
}
setcolor(LIGHTRED);
outtextxy(592,175-(i*10),"*");
}
void question ::options(int choice)
{
char ch;
int p,q,r,s,t,u;
refresh();
switch(choice)
{
case 1:
qu_no=-1;
j=1;
k=0;
i=0;
break;
case 2:
outtextxy(140,270,"Your Life Line. ");
if(f_50==1)
outtextxy(120,345,"1] 50-50.");
//outtextxy(120,415,"B] Flip."); //
if(aud_vote==1)
outtextxy(395,345,"2] Aud_Vote.");
//outtextxy(395,415,"D] Ph_freind.");
ch=getch();
switch(ch)
{
case '1':
p=answer-1;
if(p<1)p=4;
q=answer+1;
if(q>4)q=1;
refresh();
outtextxy(145,258,"Followig option are not answer");
gotoxy(35,18);
cout<<p<<" & "<<q;
getch();
f_50=0;
break;
case '2':
refresh();
outtextxy(120,270,"You have Two Life Line. ");
outtextxy(120,345,"A] 44%.");
outtextxy(120,415,"B] 19%.");
outtextxy(395,345,"C] 2%.");
outtextxy(395,415,"D] 65%.");
getch();
aud_vote=0;
break;
}
break;
}
}
//**************************************************//
// -*- Main Funciton -*- //
//**************************************************//
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(0);
Display x;
x.start();
x.boxes();
Text t;
t.put_levels();
t.put_lifeline();
t.put_name();
char ch;
int choice=1;
question q;
getch();
do
{
if (choice==1)
{
t.refresh();
q.put_ques();
}
if (choice==2)
{
t.refresh();
q.put_ques(1);
}
ch=getch();
switch(ch)
{
case '1' :
q.options(1);
choice=1;
break;
case '2' :
q.options(2);
choice=2;
break;
case '3' :
exit(0);
case 'a' :
case 'A' :
q.check_ans(1);
choice=1;
break;
case 'b' :
case 'B' :
q.check_ans(2);
choice=1;
break;
case 'c' :
case 'C' :
q.check_ans(3);
choice=1;
break;
case 'd' :
case 'D' :
q.check_ans(4);
choice=1;
break;
case 27 :
exit(0);
default:
choice=0;
}
}while(1);
}
/*------------------ -*- END OF PROGRAM -*- ----------------------------*/
//*************************************************************************
//*************************************************************************
//-------------------------------------------------------------------------
// In the Program We have Used-
// Multilevel Inheritance.
// Default Arguments.
// Classes -> Display
// Text
// Question
//*************************************************************************
//*************************************************************************
No comments:
Post a Comment