Académique Documents
Professionnel Documents
Culture Documents
1. INTRODUCTION _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 5
2. METHODOLOGY USED_ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ __ _ _ _ _ 6
3. THE WATERFALL MODEL_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 7
3.a The stages of "The Waterfall Model_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 8
3.b. Requirement Analysis & Definition_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 9
3.b.1. Resources Required_ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _ _ _ 9
3.c. System & Software Design_ _ _ _ _ _ __ _ _ _ _ __ _ _ _ _ _ _ __ _ _ _ 9
3.c.1. C++ library functions_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _10
3.c.2 C++ header (INCLUDE) file_ _ _ _ _ _ _ _ _ __ _ __ _ _ _ _ 10
3.d. Implementation & Unit Testing _ _ _ __ _ _ _ _ _ _ _ __ _ _ _ __ _ _ 12
3.e. Source code _ _ _ _ __ __ _ _ _ _ _ _ _ _ _ _ _ _ __ _ __ _ __ _ __ _ __ 13
3.f. Integration & System Testing _ _ _ __ __ _ _ _ _ _ __ _ _ __ _ _ _ _ _ 26
3.g. Operations & Maintenance_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ __ __27
3.h. Disadvantages of the Waterfall Model_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _27
4. VALIDATIONS _ _ _ _ __ _ _ _ _ _ __ _ _ _ _ __ _ _ _ _ _ __ _ _ _ _ __ _ 28
5. RESULTS _ _ _ __ _ _ __ _ __ _ __ _ _ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _29
5.a. Advantages of C++_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 29
5.b. Disadvantages of C++_ _ _ _ _ _ _ _ __ _ _ __ _ _ _ __ _ __ __ _ __ _ 29
6. COMPARISION OF C++ WITH OTHER LANGUAGES_ _ _ _ _ _ _ __ _30
7. CONCLUSION_ _ _ _ _ _ _ _ _ __ _ _ _ __ _ _ _ _ _ _ __ _ _ __ ___ __ ___ 32
8. REFRENCES_ _ _ __ _ __ __ _ __ _ __ _ __ __ __ _ __ ___ _ _ __ __ __ _33
1. INTRODUCTION
Kaun Banega Crorepati is the Indian version of the much famous 'Who wants to be a
millionaire' . Quiz contests and Quiz game shows are magnificently been popularized in
recent times. Many Quiz contests and T.V shows are often seen in the TVs. Therefore
everyone will enjoy a Quizzing game like this.
The Quizzing game show consists of set of 25 questions . They are all mutually exclusive
and they are separated through their topic classification. In the main menu options
namely play game and exit are there. One by one each question is displayed. The user
will have to guess the most correct options from the four. The computer will read the
user's choice and then declares right if it's answer code is same with the user. For every
correct answer the user is awarded some amount of money. In this way he will have to
play the game. Any wrong move will knock out the user of the game. To help the user,
to lifelines 50-50, flip the question and poll is also been incorporated in the game. On
choosing these options such as 1 for 50-50 in the play by pressing 1he can omit two
wrong options from the four. The second one that is poll will cast a vote from other
users by pressing 2 and display the percentage of vote. Flipping question the user will
press 3.The whole program is designed in graphics mode. The inclusion of graphics
mode in the C++ program makes it beautiful. During the play an assistant is also
included who specifies the users moves. He also declares the answer chosen by the
user is right or wrong. He can quit the game at any time by pressing 0. Moreover, the
program is totally correct and tested foolproof. This is the whole thing that we have
done in the project
2. METHODOLOGY USED
Until recently, programs were thought of as a series of procedures that acted upon data. A
procedure, or function, is a set of specific instructions executed one after the other. The data
was quite separate from the procedures, and the trick in programming was to keep track of
which functions called which other functions, and what data was changed. To make sense of
this potentially confusing situation, structured programming was created.
The principle idea behind structured programming is as simple as the idea of divide and
conquers. A computer program can be thought of as consisting of a set of tasks. Any task that
is too complex to be described simply would be broken down into a set of smaller component
tasks, until the tasks were sufficiently small and self-contained enough that they were easily
understood.
Some of the deficiencies of structured programming
First, it is natural to think of your data (employee records, for example) and what you can do
with your data (sort, edit, and so on) as related ideas.
Second, programmers found themselves constantly reinventing new solutions to old
problems.
Object-oriented programming attempts to respond to these needs, providing techniques for
managing enormous complexity, achieving reuse of software components, and coupling data
with the tasks that manipulate that data.The essence of object-oriented programming is to
treat data and the procedures that act upon the data as a single "object"--a self-contained
entity with an identity and certain characteristics of its own. C++ fully supports objectoriented programming, including the four pillars of object-oriented development:
encapsulation, data hiding, inheritance, and polymorphism.
Computer graphics will play a very important role there are many applications and methods
involved in the computer graphics which will be used in making of the project. The model
which we will use in this project is the WATERFALL MODEL.
3
Links
Directory
directory
of
Programming
Resources
Source Code Source code to learn from, or to incorporate into your own programs.
Code Snippets Incomplete programs that fulfill a particular task well, available for viewing
directly online, and typically shorter than the full programs available in the source code
repository. Find out more about snippets, or help other programmers by adding your own.
Programming Tips Find or contribute C and C++ programming tips and tricks.
C++ Syntax Reference Find the proper syntax for any C or C++ keyword or statement
Glossary A growing glossary of programming and computer science terms and jargon.
Function Lookup Look at the standard C and C++ functions.
Operations on characters
Operations on strings
Mathematical operations
Storage allocation procedure
Input/output operations
This section covers the few selected standard library which are essential for the basic
programming of Kaun Banega Crorepati generally defined in almost all compilers.
int main()
{
cout << "Hello, world!\n";
return 0;
}
<string.h >is the header in the C++ standard library for the C++ programming language
which contains macro definitions, constants, and declarations of functions and types used not
only for string handling but also various memory handling functionsThis ANSI header file
contains declarations for functions that manipulate strings.
<stdlib.h>This header defines several general purpose functions, including dynamic memory
management, random number generation, communication with the environment, integer
arthmetics, searching, sorting and converting.
rand
srand
calloc
free
malloc
realloc
<Dos.h> functions to link DOS system specific calls.It contains function prototypes for
interfacing to DOS interrupt routines.DOS interrupts to manipulate disk drives at the device
level and time and date functions are in this header file.
<Stdio.h> Standard I/O predefined streams stdin.stdout,stdprn,and stderr and declared
stream-level I/O routines.
<Process.h> contains structures and declarations for the spawn() and exec() functions.
8
<Graphics.h> contains the routines for graphic commands.The Borland supplies a large
number of graphics routines with Turbo C++
definite
and
Create
a.
best
possible
class
An
that
array
manner
to
holds
following
for
An
array
for
their
c.
An
array
for
the
answers
to
hold
2.
variable
Create
following
the
strings
b.
d.
solve
answers
problem
data
members:
of
questions
(true/false
probably)
provided
by
score
functions
of
for
this
user
user.
class:
a. Function that opens the disk file, reads all questions and their answers and saves them in
respective
data
member
of
your
class
b. Function that puts a question on screen and gets its response from user.
c. Function that compares actual answer with answer provided by user and increment the
score
d.
in
Function
case
that
of
prints
the
correct
result
answer.
on
screen.
3. Just create an instance of this class in your main function and calls the respective functions.
//header files
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<graphics.h>
#include<process.h>
#include<stdio.h>
#include<dos.h>
//initialization of funtions
void graphics();
void welcome();
void sound1();
void sound2();
void probar();
//initialization of variables
int x1=50;
int x2=245;
int y1=375;
int y2=415;
int n=0;
int k=0;
int j=4;
void graphics()
{
int d, m;
d = DETECT;
initgraph(&d,&m,"c:\\tc\\bgi" ); //initialization of graphic screen
}
void probar()
{
cleardevice();
setcolor(4);
settextstyle(6,0,3);
outtextxy(250,180,"! L O A D I N G !");
outtextxy(250,300," PLEASE WAIT");
for(int i=0;i<350;i++)
{
rectangle(500,250,150+i,260);
delay(4);
}
}
10
void welcome()
{
cleardevice();
//clears graphic screen
setcolor(WHITE);
setbkcolor(0);
//background color
settextstyle(4,0,4);
//for font style n size
outtext("AMITY UNIVERSITY NOIDA");
settextstyle(3,0,2);
setcolor(1);
outtextxy(160,280,"Project By :"); //for viewing text in graphic mood
outtextxy(222,300,"PERONICA SINGH");
outtextxy(222,320,"NUPUR SINHA");
outtextxy(222,340,"PRAGYA BAJAJ");
outtextxy(222,360,"JIGYASA VIRMANI");
getch();
cleardevice();
setcolor(RED);
settextstyle(7,0,4);
//for font style n size
outtextxy(110,120,"HELLO");
delay(800);
outtextxy(130,160,"WELCOME TO KAUN BANEGA CROREPATI");
delay(800);
settextstyle(7,0,2);
setcolor(WHITE);
outtextxy(300,430,"*** Press any key to START ***");
getch();
}
class que
{
friend class questset;
private:
char *s1,*s2,*s3,*s4,*s5;
char c1;
char* correct;
int ch;
public:
que()
{
ch=0;
}
void show1()
{
ch++;
cout<<s1<<endl<<endl;
11
cout<<s2<<endl;
cout<<s3<<endl;
cout<<s4<<endl;
cout<<s5<<endl;
}
void fift(int &n,int &k)
{
switch(c1)
{
case 'a':
k=1;
break;
case 'b':
k=2;
break;
case 'c':
k=3;
break;
case 'd':
k=4;
break;
}
do
{
n=(rand()%4)+1;
}
while(n==k);
cout<<"The fifty fifty options are"<<endl;
if(k==1)
cout<<"a"<<endl;
if(k==2)
cout<<"b"<<endl;
if(k==3)
cout<<"c"<<endl;
if(k==4)
cout<<"d"<<endl;
if(n==1)
cout<<"a"<<endl;
if(n==2)
12
cout<<"b"<<endl;
if(n==3)
cout<<"c"<<endl;
if(n==4)
cout<<"d"<<endl;
}
};
class questset
{
private:
que f[26];
int ko;
double m; //money
public:
questset()
{
m=10000;
}
void setMoney()
{
m=m*2;
if (m==10000000)
{
cout<<"THANKS 4 PLAYING";
getch();
exit(0);
}
}
double getMoney()
{
return m;
}
int answer()
{
char k;
int x,y,z;
cout<<"enter option"<<endl;
cin>>k;
if(k==f[ko].c1)
{
cout<<"correct answer "<<endl;
cout<<"you have won RS"<<getMoney()<<endl;
getch();
clrscr();
13
setMoney();
showq();
return 1;
}
else
{
cout<<f[ko].correct<<endl;
cout<<"sorry u loose"<<endl;
exit(0);
}
}
int select()
{
int i;
do
{
i=rand()%26;
}
while(i==ko);
return i;
}
void showq() // for life lines
{
do
{
ko=select();
}
while(f[ko].ch!=0);
f[ko].show1();
}
void flip()
{
clrscr();
showq();
}
void fifti(int & j)
{
f[ko].fift(n,k);
j=2;
}
void audience(int j,int n,int k)
{
if(j==4)
{
cout<<"for option a"<<rand()%100<<endl;
14
15
f[2].s2="A) 12";
f[2].s3="B) 13";
f[2].s4="C) 14";
f[2].s5="D) 11";
f[2].c1='b';
f[2].correct="13";
f[3].s1="Who discovered Oxygen in 1774?";
f[3].s2="A) Joseph Priestly";
f[3].s3="B) Ernest Rutherford";
f[3].s4="C) Walther Bothe";
f[3].s5="D) Newton";
f[3].c1='b';
f[3].correct="Joseph Priestly";
f[4].s1="'Checking a computer program for errors is called";
f[4].s2="A) Bugging";
f[4].s3="B) Debugging";
f[4].s4="C) Correcting";
f[4].s5="D) Syntaxing";
f[4].c1='b';
f[4].correct="debugging";
f[5].s1="the largest bird in australia";
f[5].s2="A) emu";
f[5].s3="B) kangaroo";
f[5].s4="C) ostrich";
f[5].s5="D) None of above";
f[5].c1='a';
f[5].correct="emu";
f[6].s1="who is the oldest indian prime minister?";
f[6].s2="A) jawahrlal nehru";
f[6].s3="B) morarji desai";
f[6].s4="C) atal bihari bajpai ";
f[6].s5="D) indira gandhi";
f[6].c1='b';
f[6].correct="morarji desai";
f[7].s1="The brain of a computer is";
f[7].s2="A)
f[7].s3="B)
f[7].s4="C)
f[7].s5="D)
CPU";
CD";
Floppy disc";
Megabyte";
16
f[7].c1='a';
f[7].correct="CPU";
f[8].s1="Which actress is nicknamed bebo?";
f[8].s2="A) katrina kaif";
f[8].s3="B) karishma kapoor";
f[8].s4="C) lara dutta";
f[8].s5="D) kareena kapoor";
f[8].c1='d';
f[8].correct="kareena kapoor";
f[9].s1="Which game is also called ping pong?";
f[9].s2="A) cricket ";
f[9].s3="B) badminton ";
f[9].s4="C) table tennis";
f[9].s5="D) golf";
f[9].c1='c';
f[9].correct="table tennis";
f[10].s1="Banana is a good source of which vitamin?";
f[10].s2="A) vitamin a";
f[10].s3="B) vitamin b";
f[10].s4="C) vitamin c";
f[10].s5="D) vitamin d";
f[10].c1='c';
f[10].correct="vitamin c";
f[11].s1="Name the instrument used to measure the thickness of wire";
f[11].s2="A) wire gauge";
f[11].s3="B) vernier calliper";
f[11].s4="C) manometer";
f[11].s5="D) barometer";
f[11].c1='a';
f[11].correct="wire gauge";
f[12].s1="Which is the oldest public sector bank in india?";
f[12].s2="A) allahabad bank";
f[12].s3="B) state bank of india";
f[12].s4="C) canara bank";
f[12].s5="D) vijaya bank;";
f[12].c1='a';
f[12].correct="allahabad bank";
f[13].s1="What is the official language of pakistan?";
17
f[13].s2="A) urdu";
f[13].s3="B) hindi";
f[13].s4="C) english";
f[13].s5="D) none of the above";
f[13].c1='a';
f[13].correct="urdu";
f[14].s1="In which header file does one find isalpha()";
f[14].s2="A) conio.h";
f[14].s3="B) stdio.h";
f[14].s4="C) ctype.h";
f[14].s5="D) stype.h";
f[14].c1='c';
f[14].correct="ctype.h";
f[15].s1="Which indian bank has the largets number of branches in the world";
f[15].s2="A) bank of baroda";
f[15].s3="B) allahabad bank";
f[15].s4="C) state bank of india";
f[15].s5="D) union bank of india";
f[15].c1='c';
f[15].correct="state bank of india";
f[16].s1="Which indian city was originally known as kapila;";
f[16].s2="A) patna";
f[16].s3="B) bhubhaneshwae";
f[16].s4="C) haridwar";
f[16].s5="D) cuttak";
f[16].c1='c';
f[16].correct="haridwar";
f[17].s1="Who was the last mughal emperor?";
f[17].s2="A) bahadur shah zafar";
f[17].s3="B) akbar";
f[17].s4="C) aurangzeb";
f[17].s5="D) jahangir";
f[17].c1='a';
f[17].correct="bahadur shah zafar";
f[18].s1="Who won the final match of IPL in 2010";
f[18].s2="Rajasthan royals";
f[18].s3="kolkata knight riders";
f[18].s4="chennai super kings";
18
f[18].s5="mumbai indians";
f[18].c1='c';
f[18].correct="chennai super kings";
f[19].s1="How many bones are in human body";
f[19].s2="50";
f[19].s3="106";
f[19].s4="206";
f[19].s5="125";
f[19].c1='c';
f[19].correct="206";
f[20].s1="What is the star sign of Jesus Christ?";
f[20].s2="Virgo";
f[20].s3="Capricon";
f[20].s4="Taurus";
f[20].s5="Leo";
f[20].c1='b';
f[20].correct="Capricon";
f[21].s1="Who won the first cricket world cup?";
f[21].s2="West Indies";
f[21].s3="England";
f[21].s4="Austrailia";
f[21].s5="South Africa";
f[21].c1='a';
f[21].correct="West Indies";
f[22].s1="The renewable source of energe is:";
f[22].s2="Petroleum";
f[22].s3="Kerosene";
f[22].s4="Coal";
f[22].s5="wood";
f[22].c1='d';
f[22].correct="wood";
f[23].s1="Which cricketer has scored the fastest one day century?";
f[23].s2="Sanath Jayasurya";
f[23].s3="Wasim Akram";
f[23].s4="Shahid Afridi";
f[23].s5="Steve Waugh";
f[23].c1='c';
f[23].correct="Shahid Afridi";
19
getch();
clrscr();
}
};
void main()
{
int z=0,x=0,c=0;
int driver,mode;
driver=DETECT;
initgraph(&driver, &mode, "c:\\tc\\bgi");
welcome();
probar();
closegraph();
questset q1;
q1.user_details();
q1.rules();
q1.questionset();
q1.showq();
int choice;
start:
int count = 0;
do
{
cout<<"\n\n\n\n";
cout<<" 1 ) FIFTY FIFTY \t\t\t\t 2 ) AUDIANCE POLL "<<endl;
cout<<" 3 ) FLIP \t\t\t\t\t 4 ) 0 (ZERO) FOR QUIT GAME"<<endl;
cout<<" 5) ANSWER"<<endl;
cin>>choice;
if(choice==1)
{
if(z==0)
{
q1.fifti(j);
z++;
}
else
cout<<"choice already used"<<endl;
}
else if(choice==2)
{
if(x==0)
{
q1.audience(j,n,k);
x++;
}
else
cout<<"choice already used"<<endl;
}
else if(choice==3)
21
{
if(c==0)
{
q1.flip();
c++;
goto start;
}
else
cout<<"choice already used"<<endl;}
else if(choice==4)
{
if(q1.answer()==0);
break;
}
if(choice==5)
{
q1.answer();
}
count++;
if(count >=12)
break;
}
while(choice!=0);
getch();
cout<<"Your money is"<<q1.getMoney();
}
As specified above, the system is first divided in units which are developed and tested for
their functionalities. These units are integrated into a complete system during Integration
phase and tested to check if all modules/units coordinate between each other and the system
as a whole behaves as per the specifications. After successfully testing the software, it is
delivered to the customer.
Although the source code in your file is somewhat cryptic, and anyone who doesn't know C+
+ will struggle to understand what it is for, it is still in what we call human-readable form.
Your source code file is not a program, and it can't be executed, or run, as a program can.
To turn your source code into a program, you use a compiler. How you invoke your compiler,
and how you tell it where to find your source code, will vary from compiler to compiler;
check your documentation. In Borland's Turbo C++ you pick the RUN menu command or
type tc <filename>
After your source code is compiled, an object file is produced. This file is often named with
the extension .OBJ. This is still not an executable program, however. To turn this into an
executable program, you must run your linker. C++ programs are typically created by linking
together one or more OBJ files with one or more libraries
The steps to create an executable file are
1.
Create
2.
Compile
the
source
source
code
code
into
file,
a
with
file
with
.CPP
the
.OBJ
extension.
extension.
3. Link your OBJ file with any needed libraries to produce an executable
program.
This phase of "The Waterfall Model" is virtually never ending phase (Very long). Generally,
problems with the system developed (which are not found during the development life cycle)
come up after its practical use starts, so the issues related to the system are solved after
deployment of the system. Not all the problems come in picture directly but they arise time to
time and needs to be solved; hence this process is referred as Maintenance.
The problems with one phase are never solved completely during that phase and in
fact many problems regarding a particular phase arise after the phase is signed off,
this results in badly structured system as not all the problems (related to a phase) are
solved during the same phase.
As the requirements of the customer goes on getting added to the list, not all the
requirements are fulfilled, this results in development of almost unusable system.
These requirements are then met in newer version of the system; this increases the
cost of system development.
24
4. VALIDATIONS
he project has also some validation rules, which a user must know before running it.
Even if the program is user friendly it would not work well in every cases.
First of all if a user chooses an option other than the menu, he or she will be prompted
an error massage.
Answer code option cannot be other than a, b, c & d [A, B, C & D is also valid].
An individual do not have the privilege to change the question number of a question
as it is generated automatically.
An individual do not have the privilege to skip any question or options when he is
adding some question in the run time.
A player cannot skip a question without terminating the program at the time when he
is playing the game show.
These are the main validations that are given to the program. The supervisor and its
associates must know these validations, so that they can easily monitor the outstanding
features that are been incorporated in the program
25
5. Results
C++ Best suited for general purpose and low level programming. It is the right choice for
anyone interested in programming in the next decade. C++ provides the tools of objectoriented programming and the performance of a systems-level language, which makes C++
the development language of choice.
Here are some advantages and disadvantages of C ++
5.a. Advantages:
Extremely fast
Works very well for GUI programming on a computer.
Good language to write operating systems, drivers, and platform dependent
applications with.
Good language to learn to program with.
Good
language
for
engineers.
5.b.Disadvantages
applications.
A library set is usually chosen that locks you into a single platform or
operating system.
Overly complex for very large high level programs.
Overly complex and difficult to debug when used for web applications.
Marketable skills are low level programming, vendor software, and video
games, making it difficult to find jobs unless you have are very advanced in a
target area.
26
and C# . It is possible to use operating system calls or third party libraries to do multithreaded programming, but both approaches may create portability concerns. The new C++0x
standard addresses this matter by extending the language with threading facilities.
C++ is also sometimes compared unfavourably with languages such as Smalltalk, Java, or
Eiffel on the basis that it enables programmers to "mix and match" object-oriented
programming, procedural programming, generic programming, functional programming,
declarative programming, and others, rather than strictly enforcing a single style, although
C++ is intentionally a multi-paradigm language. C++ is commonly criticized for lacking built
in garbage collection.
28
7. Conclusion
The objective of the project was to illustrate the features of C++ as well as object-oriented
programming concepts with the help of a gaming program. What can be done with C++
which cannot be done with other programming languages has been explained and illustrated.
The importance of C++ has been emphasized and the reasons why C++ been popular is listed
down
It gives us the easiest way to handle the data hiding and encapsulation with help of
powerful keywords class, public, private and protected.
Exception handling is done by the extra keywords namely try,catch and throw
It is a Extremely fast
C++ Best suited for general purpose and low level programming. It is the right choice for
anyone interested in programming in the next decade.
29
8. References
More Effective C++: 35 New Ways To improve your program and design
C++ The Complete Reference Third Edition, Herbert Schildt, Publisher: Osborne
McGraw-Hill.
http://www2.research.att.com/%7Ebs/bs_faq.html
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
http://www.wikipedia.org/
30
31