Вы находитесь на странице: 1из 41

The C++ programming language has a history going

back to 1979, when Bjarne Stroustrup was doing work for


his Ph.D. thesis. One of the languages Stroustrup had the
opportunity to work with was a language called Simula,
which as the name implies is a language primarily designed
for simulations. The Simula 67 language which was the
variant that Stroustrup worked with – is regarded as the first
language to support the object-oriented programming
paradigm. Stroustrup found that this paradigm was very
useful for software development, however the Simula
language was far too slow for practical use.Shortly
thereafter, he began work on "C with Classes", which as the
name implies was meant to be a superset of the C language.
His goal was to add object-oriented programming into the C
language, which was and still is a language well-respected
for its portability without sacrificing speed or low-level
functionality. His language included classes,
basic inheritance, inlining, default function arguments, and
strong type checking in addition to all the features of the C
language.
The first C with Classes compiler was called Cfront,
which was derived from a C compiler called CPre. It was a
program designed to translate C with Classes code to
1
ordinary C. A rather interesting point worth noting is that
Cfront was written mostly in C with Classes, making it a
self-hosting compiler (a compiler that can compile itself).
Cfront would later be abandoned in 1993 after it became
difficult to integrate new features into it, namely
C++ exceptions. Nonetheless, C front made a huge impact
on the implementations of future compilers and on the Unix
operatingsystem.

In 1983, the name of the language was changed from C with


Classes to C++. The ++ operator in the C language is an
operator for incrementing a variable, which gives some
insight into how Strou strup regarded the language. Many
new features were added around this time, the most notable
of which are virtual functions, function overloading,
references with the & symbol, the const keyword, and
single-line comments using two forward slashes (which is a
feature taken from the language BCPL).

In 1985, Stroustrup's reference to the language entitled The


C++ Programming Language was published. That same
year, C++ was implemented as a commercial product. The
language was not officially standardized yet, making the
2
book a very important reference. The language was updated
again in 1989 to include protected and static members, as
well as inheritance from several classes.

In 1990, The Annotated C++ Reference Manual was


released. The same year, Borland's Turbo C++ compiler
would be released as a commercial product. Turbo C++
added a plethora of additional libraries which would have a
considerable impact on C++'s development. Although Turbo
C++'s last stable release was in 2006, the compiler is still
widelyused.

In 1998, the C++ standards committee published the first


international standard for C++ ISO/IEC 14882:1998, which
would be informally known as C++98. The Annotated C++
Reference Manual was said to be a large influence in the
development of the standard. The Standard Template
Library, which began its conceptual development in 1979,
was also included. In 2003, the committee responded to
multiple problems that were reported with their 1998
standard, and revised it accordingly. The changed language
wasdubbed C++03.

3
In 2005, the C++ standards committee released a technical
report (dubbed TR1) detailing various features they were
planning to add to the latest C++ standard. The new standard
was informally dubbed C++0x as it was expected to be
released sometime before the end of the first decade.
Ironically, however, the new standard would not be released
until mid-2011. Several technical reports were released up
until then, and some compilers began adding experimental
support for the new features.

In mid-2011, the new C++ standard (dubbed C++11) was


finished. The Boost library project made a considerable
impact on the new standard, and some of the new modules
were derived directly from the corresponding Boost libraries.
Some of the new features included regular expression
support (details on regular expressions may be found here), a
comprehensive randomization library, a new C++ time
library, atomics support, a standard threading library (which
up until 2011 both C and C++ were lacking), a new for
loop syntax providing functionality similar to foreach loops
in certain other languages, the auto keyword, new container
classes, better support for unions and array-initialization
lists, and variadic templates.
4
Object Oriented programming
Object oriented programming is a way of solving
complex problems by breaking them into smaller problems
using objects. Before Object Oriented Programming
(commonly referred as OOP), programs were written in
procedural language, they were nothing but a long list of
instructions. On the other hand, the OOP is all about creating
objects that can interact with each other, this makes it easier
to develop programs in OOP as we can understand the
relationship between them.
Object Oriented Programming(OOP):
In Object oriented programming we write programs
using classes and objects utilizing features of OOPs such
as abstraction, encapsulation, inheritance and polymorphism.
1. Abstraction
2. Encapsulation
3. Inheritance
4. Polymorphism

5
Class and Objects :
A class is like a blueprint of data member and functions
and object is an instance of class. For example, lets say we
have a class Car which has data members (variables) such as
speed, weight, price and functions such as gearChange(),
slowDown(), brake() etc. Now lets say I create a object of
this class named FordFigo which uses these data members
and functions and give them its own values. Similarly we
can create as many objects as we want using the
blueprint(class).
Ex : //Class name is Car
class Car
{
//Data members
char name[20];
int speed;
int weight;

public:
//Functions
6
void brake(){
}
void slowDown(){
}
};

int main()
{
//ford is an object
Car ford;
}

7
Abstraction:
Data abstraction is one of the most essential and
important feature of object oriented programming in C++.
Abstraction means displaying only essential information and
hiding the details. Data abstraction refers to providing only
essential information about the data to the outside world,
hiding the background details or implementation.
Consider a real life example of a man driving a car. The
man only knows that pressing the accelerators will increase
the speed of car or applying brakes will stop the car but he
does not know about how on pressing accelerator the speed
is actually increasing, he does not know about the inner
mechanism of the car or the implementation of accelerator,
brakes etc in the car. This is what abstraction is.
Abstraction using Classes: We can implement Abstraction
in C++ using classes. Class helps us to group data members
and member functions using available access specifiers. A
Class can decide which data member will be visible to
outside world and which is not.
Abstraction in Header files: One more type of
abstraction in C++ can be header files. For example,
consider the pow() method present in math.h header file.
Whenever we need to calculate power of a number, we
8
simply call the function pow() present in the math.h header
file and pass the numbers as arguments without knowing the
underlying algorithm according to which the function is
actually calculating power of numbers.
Abstraction using access specifiers:
Access specifiers are the main pillar of implementing
abstraction in C++. We can use access specifiers to enforce
restrictions on class members. For example:
Members declared as public in a class, can be accessed
from anywhere in the program.
Members declared as private in a class, can be accessed
only from within the class. They are not allowed to be
accessed from any part of code outside the class.
We can easily implement abstraction using the above
two features provided by access specifiers. Say, the members
that defines the internal implementation can be marked as
private in a class. And the important information needed to
be given to the outside world can be marked as public. And
these public members can access the private members as
they are inside the class.

9
Encapsulation:
In normal terms Encapsulation is defined as wrapping
up of data and information under a single unit. In Object
Oriented Programming, Encapsulation is defined as binding
together the data and the functions that manipulates them.
Consider a real life example of encapsulation, in a company
there are different sections like the accounts section, finance
section, sales section etc. The finance section handles all the
financial transactions and keep records of all the data related
to finance. Similarly the sales section handles all the sales
related activities and keep records of all the sales. Now there
may arise a situation when for some reason an official from
finance section needs all the data about sales in a particular
month. In this case, he is not allowed to directly access the
data of sales section. He will first have to contact some other
officer in the sales section and then request him to give the
particular data. This is what encapsulation is. Here the data
of sales section and the employees that can manipulate them
are wrapped under a single name “sales section”.

10
Encapsulation also lead to data abstraction or hiding. As
using encapsulation also hides the data. In the above
example the data of any of the section like sales, finance or
accounts is hidden from any other section.
In C++ encapsulation can be implemented using Class
and access modifiers.

11
Inheritance:
One of the most important concepts in object-oriented
programming is that of inheritance. Inheritance allows us to
define a class in terms of another class, which makes it
easier to create and maintain an application. This also
provides an opportunity to reuse the code functionality and
fast implementation time.
When creating a class, instead of writing completely new
data members and member functions, the programmer can
designate that the new class should inherit the members of
an existing class. This existing class is called the base class,
and the new class is referred to as the derived class.
The idea of inheritance implements the is a relationship.
For example, mammal IS-A animal, dog IS-A mammal
hence dog IS-A animal as well and so on. Base and Derived
Classes
A class can be derived from more than one classes,
which means it can inherit data and functions from multiple
base classes. To define a derived class, we use a class
derivation list to specify the base class(es). A class
derivation list names one or more base classes and has the
form −
12
class derived-class: access-specifier base-class
Where access-specifier is one of public,
protected, or private, and base-class is the name of a
previously defined class. If the access-specifier is not used,
then it is private by default.
Type of Inheritance :
When deriving a class from a base class, the base class
may be inherited through public,
protected or private inheritance. The type of inheritance is
specified by the access-specifier as explained above.
We hardly use protected or private inheritance,
but public inheritance is commonly used. While using
different type of inheritance, following rules are applied −
Public Inheritance − When deriving a class from
a public base class, public members of the base class
become public members of the derived class
and protected members of the base class
become protected members of the derived class. A base
class's private members are never accessible directly from a
derived class, but can be accessed through calls to
the public and protected members of the base class.

13
Protected Inheritance − When deriving from
a protected base class, public and protected members of the
base class become protected members of the derived class.
Private Inheritance − When deriving from a private base
class, public and protected members of the base class
become private members of the derived class.
Multiple Inheritance
A C++ class can inherit members from more than one
class and here is the extended syntax −
class derived-class: access baseA, access baseB....

14
Polymorphism:
Polymorphism is a feature of OOPs that allows the
object to behave differently in different conditions.
In C++ we have two types of polymorphism:

1) Compile time Polymorphism –


This is also known as static (or early) binding.
2) Runtime Polymorphism –
This is also known as dynamic (or late) binding.
1) Compile time Polymorphism
Function overloading and Operator overloading are
perfect example of Compile time polymorphism.
Compile time Polymorphism Example
In this example, we have two functions with same name
but different number of arguments. Based on how many
15
parameters we pass during function call determines which
function is to be called, this is why it is considered as an
example of polymorphism because in different conditions
the output is different. Since, the call is determined during
compile time that’s why it is called compile time
polymorphism.

16
Project description:

1. Create/build/form your game development team


The first task in order to establish a performing team is to get to know each other. For that, do
the first two assignments.

You should read guidelines presented in Team BuildingToolkit in order to understand different
stages in team building and to achieve performing stage ASAP.

Start designing your game in a group of four (+/- 1) persons. Every team member has to have
at least one specific task (role descriptions saved from

 Project Lead (Producer, Project Manager) (in this course the leader participates at least in one of
following roles)
 Game Designer
 (Head/Lead) Programmer
 Creative Director / (Lead/Technical) Artist

In addition, you might consider having the following roles: Animator, Level Editor, Audio
Engineer, Quality Assurance Technician (aka Tester), and External Producer. Prepare to change role
during the project; you might start, for example, as a game designer and end up to write code for the
game.

The third assignment is to describe yourself so that others get an idea about your skills as a
game developer and team member. Then discuss and decide: 1) the name of your team; 2) internal
communication (channels, tools, meeting times etc.); and 3) your team goals (based on your personal
goals: what do you want to learn, what grade you are aiming at etc.; this should be written in your
personal learning report). Other topics for discussion: funding, IPR issues, contracts/agreements.

2. Create documents
In this Game programming project course, you will create the following documents:

Game project plan: Name of your project Objectives for the project Contact information list;
roles in this project (see list above) Communication plan (this was decided during the phase 1, see
above) Phase/task list (features taken from the game design document) => schedule (Gantt chart or
similar) and workload estimates Risk management plan (list potential risks, evaluate their severity and
probability, plan mitigating actions and actions if risk comes true) Game definition document(s) (1-3
pages): list the different ideas from your team and illustrate at least the following in order to decide
which game idea would be the best: Name of your game Game idea, background story, depict its'
world (=> synopsis; read instructions) Aim of the game Players actions in game In addition, consider
17
illustrating player and game interactions (how they apply to each other); the appearance of game
(graphics etc.); user interface (between game and the player); level design; and technical requirements
in brief (no details, the idea is to get reader interested / exited about your game idea).

Game design document (10-40 pages) Review (test), memos from internal meetings, and other
documents during the development phase Presentation (see below; utilize your game project website)
Final report (lessons learned; post-mortem): what did you learn, what went wrong, what went right =>
best practices; self-evaluation (process, outcomes); improvement suggestions (for yourselves and for
this course); self-evaluation (grade for the project group and, if you want to emphasize the effort of
someone or for some other reason to divide the grade, personal grade suggestions; and continuation
plan: what shall you do next (new platforms, levels etc.) If you want, you can create just one document
containing both the project plan and game design. I strongly recommend using wiki (Github) for your
game development. You can choose the tools you need in your game development project (e.g.
Bugzilla, Testlink etc.) helping to keep your game project related information up-to-date.

3. Production: create your game (prototype)


You should be aware that normally developing a full-featured game takes time (sometimes
several years). In this course, you have only a couple of months to finish your first game. Therefore, try
to build a prototype containing only the core features (so called minimum viable product, MVP) first.
It is a good practice to illustrate your idea (e.g. by creating UI mock-ups) and get feedback from your
friends and actually from anybody who is willing to offer their time to evaluate your game idea.

4. Check that you have done everything


You can and should use checklists provided by H. M. Chandler in the Game production
handbook.

5. Final presentation
Prepare a presentation which includes:

• Title page with logo and characters • “Game overview” page with short game description,
title, genre, age range, release date, number of players • “Key strengths” page with “what is new”,
“why the market needs it,” and three key selling points • “Universe” page with core spirit of game
universe, scenario, art style, characters • “Gameplay” page with player’s actions and control, rules,
player objectives, challenge • “Game structure” page with game flow, game modes (i.e. multiplayer),
length and duration, replay value • “Lessons learned” page. • “Competitors” page, with an explanation
as to why your team and your concept are better • Conceptual images

18
Program coding:

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void main()
{
clrscr();
long double amount;
amount=100;
int total=0;
int option,l,i,n,a[10],b[10],c[10],d[10],e[10],f[10],g[10];
char ch,name[20],place[25],e_mail[25];
cout<<" WELCOME TO kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
getch();
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\nBefore starting we would like to know some informatios about
you";
cout<<"\n";
cout<<"\nName:";
cin.getline(name,25);
cout<<"\nPlace:";
cin.getline(place,25);
cout<<"\nYour email id:";
cin.getline(e_mail,25);
getch();
clrscr();
cout<<" kayil oru kodi are you ready";
19
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<amount<<" in your hand";
cout<<"\nAnd it depends on how you play to get this money";
cout<<"\nHere are the rules:";
cout<<"\n1)you will be having 7 questions";
cout<<"\n2)Questions one to three you will have 4 options";
cout<<"\n3)questions four to six you will have 3 options";
cout<<"\n4)questions number seven will have 2 options and his decides your
fate";
cout<<"\n5)you are suppposed to keep keep particular amounts in the the
options as you belive that is right";
cout<<"\n6)from questions one to three you are allowed either to keep the
amount in one option or in three of them";
cout<<"\n7)you are allowed to change the amount only once through out this
game just like an life line";
cout<<"\n";
cout<<"\nPress any key to continue";
getch();
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<amount<<" in your hand";
cout<<"\nyour first question which will be having 4 option";
cout<<"\n";
cout<<"\nWho was the first president of India";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n*Dr. Rajendra Prasad* *Dr.Zahir Hussain *";
cout<<"\n********************* *********************";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 3 * * OPTION 2 *";
cout<<"\n*Jawaharlal Nehru * *Rajiv Gandhi *";

20
cout<<"\n********************* *********************";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 3 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option::";
cin>>option;
if(option==1)
{
n=4;
cout<<" you are allowed to put the amount in only three options and the
option which you believe is wrong is to be kept blank and the sum of their amount\n
should be "<<amount;
for(i=1;i<=n;++i)
{
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and\n the total amount is to be kept is "<<amount<<"::";
cin>>a[i];
amount=amount-a[i];
}
total=total+a[1];
}
if(option==2)
{
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>a[i];
if(a[i]==1)
{
total=100;

21
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option 1 Dr.rajendra Prasad";
if(a[1]>1||a[i]==1)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong";exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();
if(a[1]>0||a[i]==1)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour second question which will be having 4 option";
cout<<"\n";
cout<<"\nWhich is the capital of Manipur";
cout<<"\n********************* *********************";

22
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* Shillong * * Bhopal *";
cout<<"\n********************* *********************";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 3 * * OPTION 4 *";
cout<<"\n* Manipur * * Dedradun *";
cout<<"\n********************* *********************";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 3 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option::";
cin>>option;
if(option==1)
{
n=4;
cout<<" you are allowed to put the amount in only three options and the
option which you believe is wrong is to be kept blank and the sum of their amount\n
should be "<<amount;
for(i=1;i<=n;++i)
{
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and \nthe total amount is to be dkept is "<<amount<<":";
cin>>b[i];
amount=amount-b[i];
}
total=amount+b[3];
}
if(option==2)
{

23
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>b[i];
if(b[i]==3)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option (3) Manipur";
if(b[3]>1||b[i]==3)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong"; exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();}

if(b[3]>10||b[i]==3)
{
amount=total;

24
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour third question which will be having 4 option";
cout<<"\n";
cout<<"\nWorld climate is threatened by the increase in the concentration
of:";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* Oxygen * * Nitrogen *";
cout<<"\n********************* *********************";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 3 * * OPTION 4 *";
cout<<"\n* Hydrogen * * Carbondioxide *";
cout<<"\n********************* *********************";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 3 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option";
cin>>option;
if(option==1)
{
n=4;
cout<<" you are allowed to put the amount in only three options and the
option which you believe is wrong is to be kept blank and the sum of their amount
should\n be "<<amount;
for(i=1;i<=n;++i)
{

25
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and \nthe total amount is to be dkept is "<<amount<<":";
cin>>c[i];
amount=amount-c[i];
}
total=amount+c[4];
}
if(option==2)
{
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>c[i];
if(c[i]==4)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option (4)Carbondioxide";
if(c[4]>1||c[i]==4)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong"; exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";

26
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();}

if(c[4]>1||c[i]==4)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour fourth question which will be having 3 option";
cout<<"\n";
cout<<"\nWho was the founder of the Indian NAtional Congress";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* A O Hume * * Mahatma Gandhi *";
cout<<"\n********************* *********************";
cout<<"\n********************* ";
cout<<"\n* OPTION 3 * ";
cout<<"\n* W C Banerjee * ";
cout<<"\n********************* ";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 2 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option";
cin>>option;
if(option==1)

27
{
n=3;
cout<<" you are allowed to put the amount in only three options and the
option which you believe is wrong is to be kept blank and the sum of their amount
\nshould be"<<amount;
for(i=1;i<=n;++i)
{
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and \nthe total amount is to be kept is "<<amount<<":";
cin>>d[i];
amount=amount-d[i];
}
total=amount+d[1];
}
if(option==2)
{
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>d[i];
if(d[i]==1)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option (1)A O HUME";
if(d[1]>1||d[i]==1)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else

28
{cout<<"\nanswer is wrong"; exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();}
if(d[1]>1||d[i]==1)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour fith question which will be having 3 option";
cout<<"\n";
cout<<"\nIn Tibet the Brahmaputra is know as";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* Brahmaputra * * Tsangpo *";
cout<<"\n********************* *********************";
cout<<"\n*********************";
cout<<"\n* OPTION 3 * ";
cout<<"\n* Dihang * ";
cout<<"\n********************* ";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";

29
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 2 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option::";
cin>>option;
if(option==1)
{
n=3;
cout<<" you are allowed to put the amount in only two options and the option
which you believe is wrong is to be kept blank and the sum of their amount
\nshould be "<<amount;
for(i=1;i<=n;++i)
{
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and \nthe total amount is to be dkept is "<<amount<<":";
cin>>e[i];
amount=amount-e[i];
}
total=amount+e[2];
}
if(option==2)
{
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>e[i];
if(e[i]==2)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option (2)Tsangpo";

30
if(e[2]>1||e[i]==2)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong";exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();}
if(e[2]>1||e[i]==2)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour sixth question which will be having 3 option";
cout<<"\n";
cout<<"\nA person elected as a member of the HOUSE OF THE
PEOPLE(Lok Sabha) must be";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* 25 years * * 30 years *";
cout<<"\n********************* *********************";

31
cout<<"\n*********************";
cout<<"\n* OPTION 3 * ";
cout<<"\n* 35 years * ";
cout<<"\n********************* ";
cout<<"\n ";
cout<<"\naccording to rule number 6 you are allowed to keep the amount in
either 3 options or the whole amount in one option";
cout<<"\enter the desired option";
cout<<"\n1)keeping the amount in 2 option";
cout<<"\n2)keeping the whole amount in an single option";
cout<<"\nenter the option::";
cin>>option;
if(option==1)
{
n=3;
cout<<" you are allowed to put the amount in only two options and the option
which you believe is wrong is to be kept blank and the sum of their amount\n
should be "<<amount;
for(i=1;i<=n;++i)
{
cout<<"\nEnter the amount "<<name<<" which you desired to keep in the
option no "<<i <<"and \nthe total amount is to be dkept is "<<amount<<":";
cin>>f[i];
amount=amount-f[i];
}
total=amount+f[1];
}
if(option==2)
{
cout<<"\nYou have decided to keep the whole amount in a single option";
cout<<"\nIn which option have you decided to keep the whole amount::";
cin>>f[i];

32
if(f[i]==1)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option 1 25 years";
if(f[1]>1||f[i]==1)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong";exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();}
if(f[1]>1||f[i]==1)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"\n"<<name<<" you have Rs."<<total<<" in your hand";
cout<<"\nyour seventh and last question which will be having only option";

33
cout<<"\n";
cout<<"\nMorning is related to 'DAWN' in the same way 'NIGHT'is related to
";
cout<<"\n********************* *********************";
cout<<"\n* OPTION 1 * * OPTION 2 *";
cout<<"\n* DUSK * * MIDNIGHT *";
cout<<"\n********************* *********************";
cout<<"\n";
cout<<"\nAs it is the last question you could only use one of the options
above";

cout<<"\nIn which option have you decided to keep the whole amount";
cin>>g[i];
if(g[i]==1)
{
total;
}
}
cout<<"\n Its time for top or drop";
cout<<"\nthe right answer is "<<"Option 1 Dusk";
if(g[1]>1||g[i]==1)
{
cout<<"\nYOU are right";
cout<<"\nand your account is left with amount "<<total;
}
else
{cout<<"\nanswer is wrong"; exit(0);
}

if(total==0)
{
cout<<"you are out of the game since you have amount as Rs.0";

34
cout<<"\ndont worry keep on playing";
}
if(total<0||total>100)
{cout<<"\nyou have enter the amount incorrectely"; }
getch();
if(g[1]>1||g[i]==1)
{
amount=total;
clrscr();
cout<<" kaiyil oru kodi are you ready";
cout<<"\n *-*-*-*-*-*-*-*-*-*-*-*-*-*-*";
cout<<"CONGRATS!!!!!!!!!!!!!!!!!!!! "<<name<<" you have won
"<<amount;
cout<<name<<" from "<<place<<" have won Rs."<<amount <<" which will
be sent via your emailid "<<e_mail<< "later ";
}
getch();}

35
OutPut:

36
37
38
39
40
Conclusion:

41

Вам также может понравиться