Sunteți pe pagina 1din 34

PRACTICAL TRAINING

TOPIC : GAMING IN C++ (KAUN BANEGA CROREPATI)

FACULTY GUIDE : Ms. ANJU MISHRA

STUDENT DETAILS

1. PERONICA SINGH A2305308082 B.TECH IT (2008-2012) 4IT2X

2. NUPUR SINHA A2305308083 B.TECH IT (2008-2012) 4IT2X

3. PRAGYA BAJAJ A2305308084 B.TECH IT (2008-2012) 4IT2X

4. JIGYASSA VIRMANI A2305308088 B.TECH IT (2008-2012) 4IT2X

AMITY SCHOOL OF ENGINEERING AND TECHNOLOGY

ACKNOWLEDGEMENTS

I owe a great many thanks to a great many people who helped and supported me during this project . My deepest thanks to Ms. Anju Mishra ,lecturer, ASET ,Amity University Noida the Guide of the project for guiding and correcting various documents of mine with attention and care. She has taken pain to go through the project and make necessary correction as and when needed.I express my thanks to the director general Ms.Balvinder Shukla,Amity U niversity , Noida for extending his support. I would also thank my Institution and my faculty members without whom this project would have been a distant reality

ABSTRACT
The objective of the project is to illustrate the features of C++ as well as object-oriented programming concepts. C++ is a statically typed , free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a "middle-level" language, as it comprises a combination of both high-level and low-level language features. As one of the most popular programming languages ever created, C++ is widely used in the software industry. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. Several groups provide both free and proprietary C++ compiler software, including the GNU Project, Microsoft, Intel and Borland. C++ has greatly influenced many other popular programming languages, most notably Java. KAUN BANEGA CROREPATI -A project in C++, In this project use of graphics, arrays and of course object oriented approach. The questions are stored in arrays which are displayed on the interface randomly. There is excessive use of strings manipulation.

CONTENTS
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. The Waterfall Model


The subject of Software Engineering doesnt only deal with Software development but it about developing good software by using knowledge of available theories with the help of various defined methods and effective use of tools in hand. There are various software development approaches defined and designed which are used/employed during development process of software, these approaches are also referred as "Software Development Process Models". Each process model follows a particular life cycle in order to ensure success in process of software development. One such approach/process used in Software Development is "The Waterfall Model". Waterfall approach was first Process Model to be introduced and followed widely in Software Engineering to ensure success of the project. In "The Waterfall" approach, the whole process of software development is divided into separate process phases. The phases in Waterfall model are: Requirement Specifications phase, Software Design, Implementation and Testing & Maintenance. All these phases are cascaded to each other so that second phase is started as and when defined set of goals are achieved for first phase and it is signed off, so the name "Waterfall Model". All the methods and processes undertaken in Waterfall Model are more visible.

3.a The stages of "The Waterfall Model"

3.b. Requirement Analysis & Definition:

All possible requirements of the system to be developed are captured in this phase. Requirements are set of functionalities and constraints that the end-user (who will be using the system) expects from the system. The requirements are gathered from the end-user by consultation, these requirements are analyzed for their validity

3.b.1. RESOURCES REQUIRED


C++ software, C++ books, use of C++ and Computer Graphics Programming Links Directory A 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.

3.c.System & Software Design


Before a starting for actual coding, it is highly important to understand what we are going to create and what it should look like? The requirement specifications from first phase are studied in this phase and system design is prepared. System Design helps in specifying hardware and system requirements and also helps in defining overall system architecture.

3.c.1.C++ library functions


C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself. It is a set of predefined procedures or functions which are used to assist the programmer to prepare the progra in an efficient m manner. These standard libraries normally come along with the compiler as an utility software. The C++ Standard Library provides several generic containers, functions to utilize and manipulate these containers, function objects, generic strings and streams (including interactive and file I/O), support for some language features, and everyday functions for tasks. Most C++ compilers support the following standard library facilities:
y y y y y

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.

3.c.2 C++ header (INCLUDE) files


<iostream> is a header file which is used for input/output in the C++ programming language. It streams Input/output routines. It is part of the C++ standard library. The name stands for Input/output Stream. In C++ and its predecessor, the C programming language, there is no special syntax for streaming data input or output. Instead, these are combined as a library of functions. iostream provides basic input and output services for C++ programs. iostream uses the objects cin, cout, cerr, and clog for sending data to and from the standard streams input, output, error (unbuffered), and error (buffered) respectively eg: Hello world program can be expressed as follows: #include <iostream> using namespace std;

10

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 Generate random number (function) Initialize random number generator (functions)

calloc free malloc realloc

Allocate space for array in memory (function) Deallocate space in memory (function) Allocate memory block (function) Reallocate memory block (function)

<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.
11

<Process.h> contains structures and declarations for the spawn() and exec() functions. <Graphics.h> contains the routines for graphic commands.The Borland supplies a large number of graphics routines with Turbo C++

3.d. Implementation & Unit Testing:


In this project the main method which we used is the C++ LANGUAGE. It is an object oriented approach to programming. Following approach which we will use in the C++ are the use of arrays as well as strings in a proper, definite and best possible manner to solve the problem :

1. a. b. c. d.

Create

a An

class array array array for for

that

holds for their the to

following strings answers

data of

members: questions probably) by of user user.

An An A

(true/false provided score

answers hold

variable

2.

Create

following

functions

for

this

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 that case prints of the correct result on answer. screen.

3. Just create an instance of this class in your main function and calls the respective functions.

12

3.e. Source code

//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);
13

} } 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() {
14

ch++; cout<<s1<<endl<<endl; 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;
15

if(n==2) 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;
16

getch(); clrscr(); 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)
17

{ cout<<"for option a"<<rand()%100<<endl; cout<<"for option b"<<rand()%100<<endl; cout<<"for option c"<<rand()%100<<endl; cout<<"for option d"<<rand()%100<<endl; } if(j==2) { if(k==1) cout<<"for option a "<<rand()%100<<endl; else if(k==2) cout<<"for option b "<<rand()%100<<endl; else if(k==3) cout<<"for option c "<<rand()%100<<endl; else if(k==4) cout<<"for option d "<<rand()%100<<endl; if(n==1) cout<<"for option a "<<rand()%100<<endl; else if(n==2) cout<<"for option b "<<rand()%100<<endl; else if(n==3) cout<<"for option c "<<rand()%100<<endl; else if(n==4) cout<<"for option d "<<rand()%100<<endl; } } void questionset() // set of 25 questions { ko=0; f[0].s1="Who is known as the father of the nation?"; f[0].s2="A) gandhiji"; f[0].s3="B) netaji subhash chandra bose "; f[0].s4="C) vallabh bhai patel "; f[0].s5="D) chandra shekhar azad"; f[0].c1='a'; f[0].correct="gandhiji"; f[1].s1="which is the smallest island of lakshwadeep?"; f[1].s2="A) sindhi"; f[1].s3="B) bitra"; f[1].s4="C) orinoco"; f[1].s5="D) non of them"; f[1].c1='c'; f[1].correct="bitra";

18

f[2].s1="What is the square root of 169?"; 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) CPU"; f[7].s3="B) CD";
19

f[7].s4="C) Floppy disc"; f[7].s5="D) Megabyte"; 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";

20

f[13].s1="What is the official language of pakistan?"; 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";
21

f[18].s3="kolkata knight riders"; f[18].s4="chennai super kings"; 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";
22

f[24].s1="Fire extinguisher release which gas?"; f[24].s2="Carbondioxide"; f[24].s3="Carbon Monoxide"; f[24].s4="Oxygen"; f[24].s5="Hydrogen"; f[24].c1='a'; f[24].correct="Carbondioxide"; f[25].s1="What is the main Currency of?"; f[25].s2="Currecy chest"; f[25].s3="Meduim of exchange"; f[25].s4="Standard of postponed payments"; f[25].s5="Standard of Money"; f[25].c1='b'; f[25].correct="Meduim of exchange"; } void user_details() { char name[20],city[20], state[20]; char dream[600]; cout<<"Please enter your name "<<endl; cin>>name; cout<<"Please enter the city to which you belong "<<endl; cin>>city; cout<<"Please enter the state to which you belong "<<endl; cin>>state; } void rules() { clrscr(); cout<<"\n\n\n\t\t RULES FOR PLAYING THE GAME\n\n\n "<<endl; cout<<"\t1. You will be facing 05 questions starting from Rs.100 "<<endl; cout<<"\t2. There would be a safe point i.e. after SECOND Question"<<endl; cout<<"\t3. To assist you there will be THREE LIFELINES "<<endl; cout<<"\t a) 50 : 50 b) Audience Poll c) Flip Question "<<endl; cout<<"\t4. The above mentioned lifelines can only be used once "<<endl; cout<<"\t5. You can quit the game at any instant "<<endl; cout<<"\n\n\n\t\t HOW TO PLAY THE GAME\n\n"<<endl; cout<<"\t1. For answering a question enter the option as A or B or C or D "<<endl; cout<<"\t2. For Quiting the game press 0 "<<endl; cout<<"\t3. For using the lifeline 50-50 press 1 "<<endl; cout<<"\t4. For the Audience Poll press 2 "<<endl; cout<<"\t5. For Flipping the question press 3 "<<endl;
23

cout<<endl; cout<<" getch(); clrscr(); } };

!!! press enter to continue!!!"<<endl;

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;
24

} else if(choice==3) { 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(); }

25

3.f. Integration & System Testing


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 a source code file, with a .CPP extension.

2.

Compile

the

source

code

into

file

with

the

.OBJ

extension.

3. Link your OBJ file with any needed libraries to produce an executable program.

26

3.g. Operations & Maintenance


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.

3.h. Disadvantages of the Waterfall Model.

As it is very important to gather all possible requirements during the Requirement Gathering and Analysis phase in order to properly design the system, not all requirements are received at once, the requirements from customer goes on getting added to the list even after the end of "Requirement Gathering and Analysis" phase, this affects the system development process and its success in negative aspects.

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.

The project is not partitioned in phases in flexible way.

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.

27

4. VALIDATIONS

The 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]. Any field of the file cannot be left blank. 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

28

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:
y y y

Extremely fast Works very well for GUI programming on a computer. Good language to write operating systems, drivers, and platform dependent applications with.

y y

Good language to learn to program with. Good language for engineers.

5.b.Disadvantages
y

Although it is platform independent, it is mostly used for platform specific applications.

A library set is usually chosen that locks you into a single platform or operating system.

y y

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.

29

6.Comparison of C++ with other languages


In time, higher-level languages evolved, such as BASIC and COBOL. These languages let people work with something approximating words and sentences, such as Let I = 100. These instructions were translated back into machine language by interpreters and compilers. An interpreter translates a program as it reads it, turning the program instructions, or code, directly into actions. A compiler translates the code into an intermediary form. This step is called compiling, and produces an object file. The compiler then invokes a linker, which turns the object file into an executable program.Because interpreters read the code as it is written and execute the code on the spot, interpreters are easy for the programmer to work with. Compilers, however, introduce the extra steps of compiling and linking the code, which is inconvenient. Compilers produce a program that is very fast each time it is run. However, the time-consuming task of translating the source code into machine language has already been accomplished. Another advantage of many compiled languages like C++ is that you can distribute the executable program to people who don't have the compiler. With an interpretive language, you must have the language to run the program. For many years, the principle goal of computer programmers was to write short pieces of code that would execute quickly. The program needed to be small, because memory was expensive, and it needed to be fast, because processing power was also expensive. As computers have become smaller, cheaper, and faster, and as the cost of memory has fallen, these priorities have changed. Today the cost of a programmer's time far outweighs the cost of most of the computers in use by businesses.

Well-written, easy-to-maintain code is at a premium. Easy- to-maintain means that as business requirements change, the program can be extended and enhanced without great expense. But the current version of Standard C++ provides no language features to create multithreaded software. These facilities are present in some other languages including Java, Ada ,
30

and C# . It is possible to use operating system calls or third party libraries to do multi threaded 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.

31

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 downy

It supports all features of both structured programming and object oriented programming. It gives us the easiest way to handle the data hiding and encapsulation with help of powerful keywords class, public, private and protected. It introduces key concepts such as inheritance, polymorphism, abstraction. It provides overloading of operators and functions. Exception handling is done by the extra keywords namely try,catch and throw Provides friends, static methods constructors destructors for class objects. It is a Extremely fast

y y y y y

C++ Best suited for general purpose and low level programming. It is the right choice for anyone interested in programming in the next decade.

32

8. References

y y y y y y y y

Programmi g i C C

by D Ravi andran (second edition)

by Sumita Arora(second edition) by E Balgurusamy

Programming in C htt :// http:// http://

cprogramming.com/tutorial.html .cplusplus.com/doc/tutorial/ .cprogramming.com/ : 35 New Ways To improve your program and design

More Effective C C

The Complete Reference Third Edition, Herbert Schildt, Publisher: Osborne

McGraw-Hill. y y y http://www2.research.att.com/ Ebs/bs_faq.html

http://www.hpl.hp.com/personal/Hans_Boehm/gc/ http://www.wi ipedia.org/

33

34

S-ar putea să vă placă și