Avanish Pandey Bca Project Quiz Game in C

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 56

A Project Report

On

"QUIZ GAME USING C"


submitted in partial fulfilment of the requirement for the

Bachelor of Computer Application (BCA)


Session : 2018-2021
Affiliated to

MAHATMA GANDHI KASHI VIDYAPEETH

VARANASI

Under Supervision of : Submitted By :

Mr. Vikash Chandra Sharma Avanish Pandey


Asst. Professor BCA – VI Semester
Dept. of Computer Science Roll No. 11419407109

1
2
DECLARATION BY THE CANDIDATE

I hereby declare that the project work entitled "QUIZ GAME


USING C" submitted to SCHOOL OF MANAGEMENT SCIENCES,
VARANASI, is a record of an original work done by me under the
guidance of my mentor Mr. Vikash Chandra Sharma.

This report has not been submitted previously to any other


university for any examination.

AVANISH PANDEY
BCA – VI SEMESTER
ROLL NO.: 11419407109

3
ACKNOWLEDGEMENT

I am using this opportunity to express my gratitude to everyone who


supported me throughout the course of this BCA (3rd Year) project. I am
thankful for their aspiring guidance, invaluably constructive criticism and
friendly advice during the project work. I am sincerely grateful to them for
sharing their truthful and illuminating views on a number of issues related
to the project.

I express my warm thanks to Mr. Vikash Chandra Sharma for


their support and guidance at School of Management Sciences, Varanasi.

I would also like to thank my project mentor and all the people who
provided me with the facilities being required and conductive conditions
for my BCA – 3rd year project.

Thank you

AVANISH PANDEY

Yours sincerely,

Bhavesh Karwal

4
INDEX
TOPIC PAGE NO.

Declaration
05
Certificate

Abstract

About the Company 06

Introduction 15

Materials and Methodology 16

Design and Implementation 21

Results and Discussions 23

Conclusions and Recommendations 34

Implications for future Research 35

References 36

CONTENTS

S.NO. TITLE PAGE NO.

1 Introduction 6

5
2 Objectives 7

3 Features 7

4 Materials and Methodology 8-9

5 System Requirement 10-12

6 Design and Implementation 13-14

7 The Waterfall Model 15-17

8 Coding 18-38

9 Output 39-41

10 Conclusion and Recommendation 42

11 Implication for Future Research 43

12 References 44

6
ABSTRACT

The sole intention behind the consideration of this Project is to

generate and manage a

simple database for question. This project is developed

considering “QUIZ” information

keeping context of the customer in mind. Here, data is stored in

a binary file by

“QUESTION” and this database is basically used as MASTER

file.

The quiz game is designed to increase learning of players by

playing a multiple choice

quiz contest on various topics which is interactive, user friendly

and fun to play. The

7
various topics include Science, Mathematics, GK etc the user can add

and modify

questions according to his own wish.

8
ABOUT THE COMPANY

HISTORY:

Xchanging was founded in 1999, by David Andrews, a former partner in Andersen


Consulting Andrews came up with the idea at Andersen Consulting, to create joint
ventures with large multinationals to outsource the processing of back-office
transactions.
In 2000, Xchanging and BAE Systems created the first of these 'Enterprise
Partnerships for HR services . A second followed soon after, again with BAE Systems,
for indirect procurement.
Two years later, Xchanging and Lloyd's of London created two more 'Enterprise
Partnerships one for claims processing, and one for the London Insurance market’s
back office system; the latter including the IUA as a partner too. Further partnerships
were signed with Deutsche Bank in 2004 (launching Xchanging into the European
financial market), Aon in 2006 (in broking services) and Allianz G in 2007.
In 2007 Xchanging listed on the London Stock Exchange, entering the FTSE250
In 2009, Xchanging acquired a 75% stake in Cambridge Solutions another outsourcing
business. This acquisition was to deliver greater scale, broader international reach, and
a number of platforms for future growth.
In 2010, Xchanging further expanded in the European financial sector by developing an
eighth 'Enterprise Partnership' with Italian group, SIA-SSB.As part of this 'Enterprise
Partnership', Xchanging acquired 51% of Kedrios S.p.A. (Kedrios), the Italian
subsidiary of SIA-SSB that specialises in securities processing and fund administration
services for the Italian market. With this, Xchanging entered the Italian market. This
market is one of the larger outsourcing markets in Europe.
In mid 2010, Xchanging acquired security and technology communications company,
Data Integration. The company is an IT services business in the United Kingdom. The
company specialises in network security, application optimisation, mobility services,
high performance networks, IP telephony and open access networks. Data Integration
serves more than 300 customers in the UK, spanning the private and public sectors.
Based on a number of long-term Enterprise Partnerships and the acquisition of
Cambridge Solutions, Xchanging reported a 35% revenue increase year-on-year to
£750.4m, at the end of 2009.
On 8 February 2011, Xchanging issued a profit warning and announced a £100 million
write-off on goodwill. David Andrews stepped down with immediate effect and
became "senior adviser to the chairman", Ken Lever assumed the role of Acting Chief
Executive Officer in addition to his role as CFO.
In June 2011 Ken Lever became Chief Executive Officer with David Bauernfeind
being appointed Chief Financial Officer

9
FOUNDER DAVID ANDREWS:

Mr. David W. Andrews serves as the Chief Executive Officer of Xchanging UK Ltd.,
(alternate name Xchanging Ltd). Mr. Andrews served as Senior Adviser of Xchanging
PLC. He served as Chief Executive Officer and Member of Management Board at
Xchanging PLC. He founded Xchanging PLC in 1999. Mr. Andrews served as an
Executive Chairman and Chief Executive Officer of Cambridge Solutions, Ltd., from
January 12, 2009 to February 9th 2011. He built up Accenture's outsourcing business
and had responsibility for managing major technology replacement programmes in
Europe. In 1990, he led the successful Accounting outsourcing for British Petroleum -
the first of its kind in the world. Then in 1992, he led the massive outsourcing
arrangement for the London Stock Exchange. In 1994, Mr. Andrews relocated to Paris
to take responsibility for Accenture's business in West Europe. Over three years, he
moved West Europe from the worst to the most profitable of the 9 Accenture regions
worldwide and was also responsible for the implementation of the Xetra trading system
at Deutsche Börse. Before joining Accenture, he managed a major programme of
hospital refurbishment and health care infrastructure renewal in Congo. Mr. Andrews
serves as the Chairman of Xchanging Transaction Bank GmbH, Frankfurt /Main. His
Other Appointments includes Ins-Sure Services Ltd., Together HR Services Ltd.,
Xchanging Ltd. and Xchanging Procurement Service Ltd. He serves as a Director of
Xchanging B.V. He has been an Additional Director of Cambridge Solutions, Ltd.
since January 12, 2009. He served as a Member of the Supervisory Board of Deutsche
Börse AG from May 14, 2003 to June 3, 2007. He served as a Director of Xchanging
PLC. He is a Fellow of the Institute of Chartered Accountants and is a William Pitt
fellow of Pembroke College Cambridge. Mr. Andrews has an MA in Finance and
Administration from Sheffield University.

10
1. INTRODUCTION

3.1 INTRODUCTION

This 'QUIZ GAME' Project is designed for a question in which


user can generate and manage a simple database for questions. The
question number is automatically generated by the software and is
stored in a binary file by the name 'QUESTION'. This data base is
basically used as a MASTER file to be used as a look-up table for
information like Quiz Option, SubMenu, either
Computer/Mathematics/Science or General and the Return. There is a
sub menu in the application which conatins various topics like science,
mathematics, computers etc user can play a quiz on any of these topics
and he gets a 10 for every correct answer and zero for every wrong
answer and in the end his total score and percentage is calculated.

11
3.2 OBJECTIVE
1. The main objective of the Quiz application is to overcome all the
drawbacks of the old Quiz Game.

2. The application has been designed keeping user interaction and


friendliness the top priority. According to application a user can
play an interactive quiz without the need of having a book and
searching for various topics. He simply needs to open the
application and test, enhance his abilities.

3.3 FEATURES

1. The game designed is interactive and user friendly.

2. Simple and easy to play

3. Easy to modify

4. There is a score card and a percentage calculator.

12
2. MATERIALS AND METHODOLOGY

4.1 INTRODUCTION TO C++C :

C is a procedural programming language. It was initially developed


by Dennis Ritchie in the year 1972. It was mainly developed as a system
programming language to write an operating system. The main features
of the C language include low-level memory access, a simple set of
keywords, and a clean style, these features make C language suitable for
system programmings like an operating system or compiler development.  
Many later languages have borrowed syntax/features directly or indirectly
from the C language. Like syntax of Java, PHP, JavaScript, and many
other languages are mainly based on the C language. C++ is nearly a
superset of C language (Few programs may compile in C, but not in C+
+). C++ (pronounced "see plus plus") is a statically typed, free-
form, multi-paradigm, compiled, general-purpose programming language.
It is regarded as an intermediate-level language, as it comprises both high-
level and low-level language features. Developed by Bjarne
Stroustrup starting in 1979 at Bell Labs, C++ was originally named C with
Classes, adding object oriented features, such as classes, and other
enhancements to the C programming language The language was renamed
C++ in 1983,as a pun involving the increment operator

C++ is one of the most popular programming languages and is


implemented on a wide variety of hardware and operating system
platforms. As an efficient compiler to native code, 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
13
free and proprietaryC+
+ compiler software,includingthe GNUProject, LLVM, Microsoft Intel and
Embarcadero Technologies. C++ has greatly influenced many other
popular programming languages, most notably C#  and Java.

C++ is also used for hardware design, where the design is initially


described in C++, then analyzed, architecturally constrained, and
scheduled to create a register-transfer level hardware description
language via high-level synthesis.

The language began as enhancements to C, first


adding classes,then virtual functions, operator overloading, multiple
inheritance, templates and exception handling among other features. After
years of development, the C++ programming language standard was
ratified in 1998 as ISO/IEC 14882:1998. The standard was amended by the
2003 technical corrigendum, ISO/IEC 14882:2003. The current standard
extending C++ with new features was ratified and published by ISO in
September 2011 as ISO/IEC 14882:2011.

4.1.1 HISTORY:

History of C language is interesting to know. Here we are going to


discuss a brief history of the c language.

C programming language was developed in 1972 by Dennis Ritchie at


bell laboratories of AT&T (American Telephone & Telegraph), located in
the U.S.A.

Dennis Ritchie is known as the founder of the c language.

14
It was developed to overcome the problems of previous languages such as
B, BCPL, etc.

Initially, C language was developed to be used in UNIX operating


system. It inherits many features of previous languages such as B and
BCPL.

Bjarne Stroustrup, a Danish and British trained computer scientist, began his work on
"C with Classes" in 1979.The idea of creating a new language originated from
Stroustrup's experience in programming for his Ph.D. thesis. Stroustrup found
that Simula had features that were very helpful for large software development, but the
language was too slow for practical use, while BCPL was fast but too low-level to be
suitable for large software development. When Stroustrup started working in AT&T
Bell Labs, he had the problem of analyzing the UNIX kernel with respect to distributed
computing. Remembering his Ph.D. experience, Stroustrup set out to enhance
the C language with Simula-like features. C was chosen because it was general-
purpose, fast, portable and widely used. Besides C and Simula, some other languages
that inspired him were ALGOL 68, Ada, CLU and ML. At first, the class, derived
class, strong typing, inlining, and default argument features were added to C via
Stroustrup's "C with Classes" to C compiler, Cpre.
In 1983, the name of the language was changed from C with Classes to C++ (++ being
the increment operator in C). New features were added includingvirtual functions,
function name and operator overloading, references, constants, user-controlled free-
store memory control, improved type checking, and BCPL style single-line comments
with two forward slashes (//), as well as the development of a proper compiler for C+
+, Cfront. In 1985, the first edition of The C++ Programming Language was released,
providing an important reference to the language, as there was not yet an official
standard.The first commercial implementation of C++ was released in October of the
same year.Release 2.0 of C++ came in 1989 and the updated second edition of The C+
+ Programming Languagewas released in 1991 New features included multiple
inheritance, abstract classes, static member functions, const member functions, and
protected members. In 1990, The Annotated C++ Reference Manual was published.
This work became the basis for the future standard. Late feature additions
included templates, exceptions, namespaces, new casts, and a Boolean type.
As the C++ language evolved, the standard library evolved with it. The first addition to
the C++ standard library was the stream I/O library which provided facilities to replace
the traditional C functions such as printf and scanf. Later, among the most significant
additions to the standard library, was a large amount of the Standard Template Library.
It is possible to write object oriented or procedural code in the same program in C++.
This has caused some concern that some C++ programmers are still writing procedural
code, but are under the impression that it is object oriented, simply because they are

15
using C++. Often it is an amalgamation of the two. This usually causes most problems
when the code is revisited or the task is taken over by another coder.
C++ continues to be used and is one of the preferred programming languages to
develop professional applications.

4.1.2 FEATURES OF C++

Features of C Programming Language:  


 

1. Procedural Language
2. Fast and Efficient
3. Modularity
4. Statically Type
5. General-Purpose Language
6. Rich set of built-in Operators
7. Libraries with rich Functions
8. Middle-Level Language
9. Portability
10.Easy to Extend
 
1)   Classes: By using classes we can create user defined data types. In
other words the class is the collection of set of data and code. The class
allows us to do some things which are polymorphism, inheritance,
abstraction, encapsulation which are our next features. The objects are the
instances of classes.

 
2)   Inheritance: Inheritance allows one data type to acquire properties of
other data types. Inheritance from a base class may be declared as public,

16
protected, or private. If the access specifier is omitted, a “class” inherits
privately, while a “struct” inherits publicly. This provides the idea of
reusability that means we can add the new features to an existing class
without modifying it.
 
3)  Data Abstraction and Encapsulation: Encapsulation means hiding of
data from the data structures or in other words wrapping up of data in
single entity is known as Encapsulation. In this the data is not accessible to
outside world and only the  functions are allowed to access it.  When we
want to write the class in which we don’t have the knowledge about the
arguments used to instantiate it then we can use templates in C++.
Abstraction can be defined as the act of representing essential features
without including background details.
 
 
4)   Polymorphism: it means that the one interface can be used for many
implementation so that object can behave differently for each
implementation. The different types of polymorphism are static (Compile
time) and dynamic (Run time).
 
5)   Dynamic Binding: It means that the linking of a procedure call to code
to be executed in response to the call. A function call associated with a
polymorphic reference depends on the dynamic type that reference. And at
run-time the code matching the object under current reference will be
called.
 
6)   Message Passing: An object oriented program consists of the set of
objects that communicate with each other. objects communicate with one
17
another by sending and receiving information much the same way as
people pass messages to one another. The concept of message passing
makes it easier to direct model or simulate their real world counterparts.

4.2

18
SYSTEM REQUIRMENTS

Following hardware specifications and software are required to run this project:

4.2.1 SOFTWARE REQUIREMENTS

Following hardware specifications and software are required to run this project:

This Application is Developed in C++ Technology.

1) Operating System: Windows XP Service Pack 1

2) Turbo C3 compiler.

4.2.2 HARDWARE REQUIREMENTS


Processor : Pentium IV or more

Speed : 2.0 GHZ or more

Memory : 64 MB RAM or more

Hard Disk Drive : 5 MB or more

4.3

SOFTWARE DESCRIPTION

4.3.1 TURBO CC++

Turbo C was an integrated development environment (IDE) for


programming in the C language. It was developed by Borland and first
introduced in 1987. At the time, Turbo C was known for its compact size,
comprehensive manual, fast compile speed and low price. It had many
similarities to an earlier Borland product, Turbo Pascal, such as an IDE, a

19
low price and a fast compiler, but was not as successful because of
competition in the C compiler market.

Turbo C was a software development tool for writing programs in


the C language. As an IDE, it included a source code editor, a fast
compiler, a linker and an offline help file for reference. Version 2 included
a built-in debugger. Turbo C was a follow-up product to Borland's Turbo
Pascal, which had gained widespread use in educational institutions
because the Pascal language was suited for teaching programming to
students. Although Turbo C was initially developed by a different
company, it shared a lot of features with Turbo Pascal, namely, the look-
and-feel of the interface and the various programming and debugging tools
included. However, it was not as successful as Turbo Pascal because of
competition from other C products such as Microsoft C, Watcom C,
Lattice C, etc. Nevertheless, Turbo C still had the advantage in compile
speed and price.

The first version was released on May 13, 1987, and it offered the
first-ever edit-compile-run environment for software development on IBM
PCs. Turbo C was not originally developed by Borland but was bought
from Bob Jervis and was initially called Wizard C. Turbo Pascal did not
have pull-down menus before this time, and it was only on its fourth
version that it received a face lift to look like Turbo C.

Borland as a company no longer develops and sells these products,


but Turbo C still lives on as a free download from various online
repositories, although it is really an old technology without real technical
support and is no longer viable for modern software development. Turbo C

20
eventually evolved into Turbo C++, then into Borland C++ and, finally,
into C++ Builder.

Turbo C features:

 Inline assembly with full access to the C language symbolic


structures and names -- This allowed programmers to write some
assembly language codes right into their programs without the need
for a separate assembler.
 Support for all memory models -- This had to do with the segmented
memory architecture used by 16-bit processors of that era, where
each segment was limited to 64 kilobytes (Kb). The models were
called tiny, small, medium, large and huge, which determined the
size of the data used by a program, as well as the size of the program
itself. For example, with the tiny model, both the data and the
program must fit within a single 64-Kb segment. In the small model,
the data and the program each used a different 64-Kb segment. So in
order to create a program larger than 64 Kb or one that manipulates
data larger than 64 Kb, the medium, large and huge memory models
had to be used. In contrast, 32-bit processors used a flat memory
model and did not have this limitation.
 Speed or size optimization -- The compiler could be configured to
produce an executable program that was either fast or small in size,
but not both.
 Constant folding -- This feature allowed the Turbo C compiler to
evaluate constant expressions during compile time rather than during
run time.
21
Turbo C++ is a C++ compiler and integrated development environment and computer
language originally from Borland. Most recently it was distributed by Embarcadero
Technologies, which acquired all of Borland's compiler tools with the purchase of
its CodeGear division in 2008. The original Turbo C++ product line was put on hold
after 1994, and was revived in 2006 as an introductory-level IDE, essentially a
stripped-down version of their flagship C++Builder. Turbo C++ 2006 was released on
September 5, 2006 and was available in 'Explorer' and 'Professional' editions. The
Explorer edition was free to download and distribute while the Professional edition was
a commercial product. In October 2009 Embarcadero Technologies discontinued
support of its 2006 C++ editions. As such, the Explorer edition is no longer available
for download and the Professional edition is no longer available for purchase
from Embarcadero Technologies. Turbo C++ is succeeded by C++Builder. The first
release of Turbo C++ was made available during the MS-DOS era on personal
computers. Version 1.0, running on MS-DOS, was released in May 1990.
An OS/2 version was produced as well. Version 1.01 was released on February 28,
1991, running on MS-DOS. The latter was able to generate both COM
and EXE programs, and was shippedwithBorland's Turbo Assembler compiler for
Intel x86 processors. The initial version of the Turbo C++ compiler was based on a
front end developed by TauMetric (TauMetric was later acquired by Sun
Microsystems and their front end was incorporated in Sun C++ 4.0, which shipped in
1994).This compiler supported the AT&T 2.0 release of C++.
Turbo C++ 3.0 was released in 1991 (shipping on November 20), and came in amidst
expectations of the coming release of Turbo C++ for Microsoft Windows. Initially
released as an MS-DOS compiler, 3.0 supported C++ templates, Borland's inline
assembler, and generation of MS-DOS mode executables for both 8086 real-mode &
286-protected (as well as the Intel 80186.) 3.0's implemented AT&T C++ 2.1, the most
recent at the time. The separate Turbo Assembler product was no longer included, but
the inline-assembler could stand in as a reduced functionality version.
Soon after the release of Windows 3.0, Borland updated Turbo C++ to support
Windows application development. The Turbo C++ 3.0 for Windows product was
quickly followed by Turbo C++ 3.1(and then Turbo C++ 4.5). It's possible that the
jump from version 1.x to version 3.x was in part an attempt to link Turbo C++ release
numbers with Microsoft Windows versions; however, it seems more likely that this
jump was simply to synchronize Turbo C and Turbo C++, since Turbo C 2.0 (1989)
and Turbo C++ 1.0 (1990) had come out roughly at the same time, and the next
generation 3.0 was a merger of both the C and C++ compiler.
Starting with version 3.0, Borland segmented their C++ compiler into two distinct
product-lines: "Turbo C++" and "Borland C++". Turbo C++ was marketed toward the
hobbyist and entry-level compiler market, while Borland C++ targeted the professional
application development market. Borland C++ included additional tools, compiler
code-optimization, and documentation to address the needs of commercial developers.
Turbo C++ 3.0 could be upgraded with separate add-ons, such as Turbo Assembler
and Turbo Vision 1.0.

22
Version 4.0 was released in November 1993 and was notable (among other things) for
its robust support of templates. In particular, Borland C++ 4 was instrumental in the
development of theStandard Template Library, expression templates, and the first
advanced applications of template metaprogramming. With the success of the Pascal-
evolved product Delphi, Borland ceased work on their Borland C++ suite and
concentrated on C++Builder for Windows. C++Builder shared Delphi's front-end
application framework, but retained the Borland C++ back-end compiler. Active
development on Borland C++/Turbo C++ was suspended until 2006.

23
3. DESIGN AND IMPLEMENTATION

5.1 DESIGN

Earlier QUIZ Game was conducted manually in which there


used to be a Quiz Master asking questions with a book which was
neither flexible nor friendly. So an automated Quiz Game is
desingeddesigned to play quiz game in a more interactive and fun way
which is felxibleflexible and more reliable.

5.1.1. EXISTING SYSTEM

The Quiz Game was conducted manually. The Quiz Master had
a book of questions which contained qustionsquestions related to
various topics.

5.1.2 PROPOSED SYSTEM

 In comparison to the present system the proposed system will be


less time consuming and is more efficient.
 Quiz will be very easy as all in the new proposed system, the
process of quiz game is fully automated.
 The proposed system is highly error and mistake proof as no
information has to be entered manually thus reducing the
human prone errors.

 Database of the player is stored in a record file.

24
5.2 IMPLEMENTATION

The following data flow diagram describes the Implementation of the


proposed system:

DATA FLOW DIAGRAM OF QUIZ GAME

QUIZ GAME
QUIZ GAME

PLAY EDIT
ADD QUESTIONS

COMPUTERS
DELETE
RETURN
MODIFY
MATHS
GENERAL
SCIENCE

25

D.B.M.S
Fig (1)

THE WATERFALL MODEL

The subject of Software Engineering doesn’t 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.

26
The stages of "The Waterfall Model"

27
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

28
CODING
//c
proj
ect
on
quiz
game
by
deep
ak
shar
ma
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
void show_record();
void reset_score();
void help();
void edit_score(float,char[]);
int main()
{
int countr,r,r1,count,i,n;
float score;
char choice;
char playername[20];
mainhome:
printf("\t\t\t << QUIZ GAME >>\n");
printf("\n\t\
t****************************************");

29
printf("\n\t\t\t WELCOME\n ");
printf("\n\t\t\t to\n ");
printf("\n\t\t\t THE QUIZ GAME ");
printf("\n\t\t");
printf("\n\t\
t****************************************");
printf("\n\t\t BECOME RICH EARN UPTO 1 MILLION
$ ;-) ");
printf("\n\t\
t****************************************");
printf("\n\t\t > Press S to start the game");
printf("\n\t\t > Press V to view the highest score ");
printf("\n\t\t > Press R to reset score");
printf("\n\t\t > press H for help ");
printf("\n\t\t > press Q to quit ");
printf("\n\t\t________________________________________\
n\n");
choice=toupper(getch());

if(choice=='V')
{
system("cls");
show_record();
system("cls");
goto mainhome;
}

30
else if(choice=='H')
{
system("cls");
help();
getch();
system("cls");
goto mainhome;
}

else if(choice=='R')
{
system("cls");
reset_score();
getch();
goto mainhome;
}

else if (choice=='Q')
{
exit(1);
}

else if(choice=='S')
{
system("cls");
printf("\n\n\n\n\n\n\n\n\n\n\t\t\tResister your name:");
gets(playername);

31
system("cls");
printf("\n *********** Welcome %s to C Program Quiz
Game *****************",playername);
printf("\n\n Here are some tips you might wanna know
before playing:");
printf("\n
******************************************************
**************************");
printf("\n >> There are 2 rounds in this Quiz
Game,WARMUP ROUND & CHALLANGE ROUND");
printf("\n >> In warmup round you will be asked a total of
3 questions to test your");
printf("\n general knowledge. You are eligible to play the
game if you give atleast 2");
printf("\n right answers, otherwise you can't proceed
further to the Challenge Round.");
printf("\n >> Your game starts with CHALLANGE
ROUND. In this round you will be asked a");
printf("\n total of 10 questions. Each right answer will be
awarded with 10 points!");
printf("\n By this way you can score upto
100 :-) :-):-):-):-):-):-)!!!!!..........");
printf("\n >> You will be given 4 options and you have to
press A, B ,C or D for the");
printf("\n right option.");
printf("\n >> You will be asked questions continuously, till
right answers are given");

32
printf("\n >> No negative marking for wrong answers!");
printf("\n\n\t!!!!!!!!!!!!! ALL THE BEST !!!!!!!!!!!!!");
printf("\n\n\n Press Y to start the game!\n");
printf("\n Press any other key to return to the main
menu!");

if (toupper(getch())=='Y')
{
system("cls");
goto home;
}

else
{
system("cls");
goto mainhome;
}

home:
system("cls");
count=0;

for(i=1;i<=3;i++)
{
r1=i;
switch(r1)

33
{
case 1:
printf("\n\nA collecion of 8 bits are called?");
printf("\n\nA.bit\t\tB.word\n\nC.byte\t\
tD.record");
if (toupper(getch())=='C')
{
printf("\n\nCorrect!!!");
count++;
getch();
system("cls");
break;
}

else
{
printf("\n\nWrong!!! The correct answer is
C.byte");
getch();
system("cls");
break;
}
case 2:
printf("\n\nWhich of the following is a
Palindrome number?");
printf("\n\nA.42042\t\tB.101010\n\nC.23232\t\

34
tD.01234");
if (toupper(getch())=='C')
{
printf("\n\nCorrect!!!");
count++;
getch();
system("cls");
break;
}

else
{
printf("\n\nWrong!!! The correct answer is
C.23232");
getch();
system("cls");
break;
}

system("cls");

case 3:
printf("\n\n\nWhich of the following is most
oriented toward scientific programming ?");
printf("\n\nA.Cobol\t\tB.Fortran\n\nC.c++\t\
tD.Basic");

35
if (toupper(getch())=='B')
{
printf("\n\nCorrect!!!");
count++;
getch();
system("cls");
break;
}

else
{
printf("\n\nWrong!!! The correct answer is
B.Fortran");
getch();
system("cls");
break;
}
}
}

if(count>=2)
{
goto test;
}

36
else
{
system("cls");
printf("\n\nSORRY YOU ARE NOT ELIGIBLE
TO PLAY THIS GAME, BETTER LUCK NEXT TIME");
getch();
goto mainhome;
}

test:
system("cls");
printf("\n\n\t*** CONGRATULATION %s you are eligible
to play the Game ***",playername);
printf("\n\n\n\n\t!Press any key to Start the Game!");
if(toupper(getch())=='p')
{
goto game;
}

game:
countr=0;
for(i=1;i<=10;i++)
{
system("cls");
r=i;

37
switch(r)
{
case 1:
printf("\n\nAll are the example of input devices
Except a:");
printf("\n\nA.Scanner\t\tB.Mouse\n\nC.Printer\t\
tD.Keyboard");
if (toupper(getch())=='C')
{
printf("\n\nCorrect!!!");countr++;getch();
break;
getch();
}

else
{
printf("\n\nWrong!!! The correct answer is
C.Printer");
getch();
goto score;
break;
}

case 2:
printf("\n\n\nWhat kind of file extension .mpg?,");
printf("\n\nA.Movie file \t\tB.Text file\n\nC.Image

38
file\t\tD.Audio file");
if (toupper(getch())=='A')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;
}

else
{
printf("\n\nWrong!!! The correct answer is A.Movie
file");
getch();
goto score;
break;
}
case 3:
printf("\n\n\nA DVD is an example of a/an.. ");
printf("\n\nA.Magnetic disk\t\tB.Hard disk\n\
nC.Output device\t\tD.Optical disk");
if (toupper(getch())=='D')
{
printf("\n\nCorrect!!!");
countr++;
getch();

39
break;
}
else
{
printf("\n\nWrong!!! The correct answer is
D.Optical disk");
getch();
goto score;
break;
}
case 4:
printf("\n\n\nWho is he founder of facebook?");
printf("\n\nA.Mark zuckerburg\tB.Tesla\n\
nC.Steve jobs\t\tD.Bill gates");
if (toupper(getch())=='A')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;
}

else
{
printf("\n\nWrong!!! The correct answer is A.Mark
zuckerburg");
getch();

40
goto score;
break;
}

case 5:
printf("\n\n\nWhich of he following is a web
browser?");
printf("\n\nA.Dreamweaver\tB.Netscape navigator\
n\nC.Maya\t\tD.Flash");
if(toupper(getch())=='B')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;}
else
{
printf("\n\nWrong!!! The correct answer is
B.Netscape navigator");
getch();
goto score;
break;
}
case 6:
printf("\n\n\nWhat kind of file extension .bak?,");
printf("\n\nA.Backup file \t\tB.Text file\n\nC.Image
file\t\tD.Audio file");

41
if (toupper(getch())=='A')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;}
else
{
printf("\n\nWrong!!! The correct answer is
A.Backup file");
getch();
goto score;
break;
}

case 7:
printf("\n\n\nwhich of he following is a read only
memory storage device ");
printf("\n\nA.Flash drive\t\tB.Hard disk\n\
nC.Floppy disk\t\tD.CDROM");
if(toupper(getch())=='D')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;}
else

42
{
printf("\n\nWrong!!! The correct answer is
D.CDROM");
getch();
goto score;
break;
}
case 8:
printf("\n\n\nThe _____ shows all the web sites any
pages that you have visited one of recent time ");
printf("\n\nA.Hisory list\t\tB.Status bar \n\nC.task
bar\t\tD.record");
if(toupper(getch())=='A')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;}
else
{
printf("\n\nWrong!!! The correct answer is
A.Hisory list");
getch();
goto score;
break;
}
case 9:

43
printf("\n\n\nA 32 bit word computer can access
____ bytes at a time ");
printf("\n\nA.32\t\tB.16\n\nC.8\t\tD.4");
if(toupper(getch())=='C')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;}
else
{
printf("\n\nWrong!!! The correct answer is
C.8");
getch();
goto score;
break;
}
case 10:
printf("\n\n\nWho is the founder of pixar animation?");
printf("\n\nA.Mark zuckerburg\tB.Tesla\n\
nC.Steve jobs\t\tD.Bill gates");
if(toupper(getch())=='C')
{
printf("\n\nCorrect!!!");
countr++;
getch();
break;

44
}
else
{
printf("\n\nWrong!!! The correct answer is
C.Steve jobs");
getch();
goto score;
break;
}
}
}

score:
system("cls");
score=(float)countr*100000;
if(score>0.00 && score<1000000)
{
printf("\n\n\t\t****************
CONGRATULATION *****************");
printf("\n\t You won $%.2f",score);
goto go;
}
else if(score==1000000.00)
{
printf("\n\n\n \t\t****************

45
CONGRATULATION ****************");
printf("\n\t\t\t\t YOU ARE A
MILLIONAIRE!!!!!!!!!");
printf("\n\t\t\t\t You won $%.2f",score);
printf("\n\t\t\t\t Thank You !!");
}
else
{
printf("\n\n\t******** SORRY YOU DIDN'T WIN
ANY CASH ********");
printf("\n\t\t Thanks for your participation");
printf("\n\t\t TRY AGAIN");
goto go;
}
go:
puts("\n\n Press Y if you want to play next game");
puts(" Press any key if you want to go main menu");
if (toupper(getchar())=='Y')
{
goto home;
}
else
{
edit_score(score,playername);
goto mainhome;
}
}

46
}
void show_record()
{

char name[20];
float scr=0;
FILE *f;
f=fopen("score.txt","r");
fscanf(f,"%s%f",&name,&scr);
printf("\n\n\t\
t******************************************************
*******");
printf("\n\n\t\t %s has secured the Highest Score
%f",name,scr);
printf("\n\n\t\
t******************************************************
*******");
fclose(f);
getch();
}
void reset_score()
{
system("cls");
float sc;
char nm[20];
FILE *f;
f=fopen("score.txt","r+");

47
fscanf(f,"%s%f",&nm,&sc);
sc=0;
fprintf(f,"%s,%.2f",nm,sc);
fclose(f);
}
void help()
{
system("cls");
printf("\n\n HELP");
printf("\n
-------------------------------------------------------------------------");
printf("\n ......................... C program Quiz Game...........");
printf("\n >> There are two rounds in the game, WARMUP
ROUND & CHALLANGE ROUND");
printf("\n >> In warmup round you will be asked a total of 3
questions to test your general");
printf("\n knowledge. You will be eligible to play the game
if you can give atleast 2");
printf("\n right answers otherwise you can't play the
Game...........");
printf("\n >> Your game starts with the CHALLANGE
ROUND. In this round you will be asked");
printf("\n total 10 questions each right answer will be
awarded $100,000.");
printf("\n By this way you can win upto ONE MILLION
cash prize in USD...............");
printf("\n >> You will be given 4 options and you have to

48
press A, B ,C or D for the");
printf("\n right option");
printf("\n >> You will be asked questions continuously if you
keep giving the right answers.");
printf("\n >> No negative marking for wrong answers");
printf("\n\n\t*********************BEST OF
LUCK*********************************");
printf("\n\n\t*****C PROGRAM QUIZ GAME is
developed byDEEPAK SHARMA AP GOYAL SHIMLA
UNIVERSITY********");}
void edit_score(float score, char playernm[20])
{
system("cls");
float sc;
char nm[20];
FILE *f;
f=fopen("score.txt","r");
fscanf(f,"%s%f",&nm,&sc);
if (score>=sc)
{
sc=score;
fclose(f);
f=fopen("score.txt","w");
fprintf(f,"%s\n%.2f",playernm,sc); //print in player
name
fclose(f);
}

49
}

50
OUTPUT 4. RESULTS AND DISCUSSIONS

51
52
53
CONCLUSION AND RECOMMENDATIONS

The Quiz Game designed is very interactive, user friendly and


easy to play. The game allows the user to choose the topic of his
interest and test his knowledge. The question database can be easily
modified like adding, deleting or changing the questions is very easy.

Recommendations are more and more games like these should


be desgineddesigned as it improves the knowledge and at the same
time test ur IQ level. Quiz games should be designed in a more
interactive and friendly way so that more people can play, enjoy and
at the same time improve, enhance and test their knowledge.

54
6. IMPLICATIONS FOR FUTURE RESEARCH

Nothing is 100% perfect, there always a scope of improvement.


Similarly this project can be improved further. There are many areas
in this project which can be expanded more on a larger scale that
could not be achieved due limited time and resources. Some more
research needs to be done to meet the requirements of a learner.
Following are some implications and changes that can be done in this
project.

Additional features which could be added to the application is


improving the graphical user interface, adding features of the like IQ
AND EQ and making it more user friendly and interactive so that
more and more players can play and enjoy the game with ease.

55
REFERENCES

[1] “LET US C++” by Yashwant Kanetkar

[2] www.gobookee.net/objective-type-questions-C++-language/

[3] www.gobookee.net/objective-type-questions-and-answers-in-dbms/

[4] www.gobookee.net/objective-type-questions-and-answers-in-c/

[5] “ The C++ Programming Language” by Bjarne Stroupstup

[6] “ Modern C++ Design” by Andrei Alexandrescu

[7]  “Effective C++” by Scott Meyers

56

You might also like