0% found this document useful (0 votes)
4 views13 pages

DSA Report

The project report details the development of a C-based Quiz Game designed to test users' general knowledge through two rounds: a Warmup Round and a Challenge Round. It emphasizes fundamental C programming concepts such as loops, conditional statements, and file handling, while also allowing users to compete for the highest score. The report includes sections on implementation, requirements, results, and future enhancements for the game.

Uploaded by

shraddha.yugal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

DSA Report

The project report details the development of a C-based Quiz Game designed to test users' general knowledge through two rounds: a Warmup Round and a Challenge Round. It emphasizes fundamental C programming concepts such as loops, conditional statements, and file handling, while also allowing users to compete for the highest score. The report includes sections on implementation, requirements, results, and future enhancements for the game.

Uploaded by

shraddha.yugal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Quiz Game

Project Report

by

Pranjal Piyush RA2311003030109


Daksh Gupta RA2311003030112
Shraddha RA2311003030119
Shreya Mehndiratta RA2311003030086

Under the guidance of

Dr. Dinesh Kumar


(Associate Professor, Department of Computer Science and Engineering)
in partial fulfilment for the course
of
21CSC201J - Data Structures and Algorithm

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY


Delhi-NCR Campus, Modinagar, Ghaziabad (U.P.)
(B. Tech. II -Year, III-SEMESTER)

(2024-25)
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
(Under Section 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified that the project report for the course 21CSC201j Data Structures and
Algorithm entitled in “Quiz Game in C” is the bonafide work Pranjal Piyush
RA2311003030109, Daksh Gupta RA2311003030112, Shraddha
RA2311003030119, Shreya Mehndiratta RA2311003030086 who carried out the
work under my supervision.

SIGNATURE SIGNATURE

Dr. Dinesh Kumar Dr. Avneesh Vashistha


Associate Professor Head of Department
Computer Science and Engineering Computer Science and Engineering
ABSTRACT
This project presents a C-based Quiz Game designed to test users' general knowledge.
The game is divided into two rounds: the Warmup Round, which determines whether a
player qualifies for the main quiz, and the Challenge Round, where players answer a
series of multiple-choice questions to earn points. The game stores the highest score,
allowing users to compete for the top spot. The project demonstrates fundamental C
programming concepts, including loops, conditional statements, and file handling,
making it an excellent learning tool for beginners.
TABLE OF CONTENTS

CHAPTERS CONTENTS PAGE NO.

1. Introduction 1

2. Requirements 1

3. Implementation 2

4. Code 4

5. Result 6

6. Conclusion 8
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have supported and guided
me throughout the development of this project.

Firstly, I extend my heartfelt thanks to Dr. Dinesh Kumar, our Faculty Coordinator, for
her invaluable guidance, continuous encouragement, and timely feedback throughout
the project. Her mentorship has been crucial in shaping my understanding and pushing
me toward excellence.

I would also like to acknowledge the tremendous support and collaboration of my group
members. Their dedication, teamwork, and efforts played a significant role in the
successful completion of this project, and I am grateful for their cooperation at every
stage.

A special thanks to Dr. R. P. Mahapatra, Dean E&T (Engineering and Technologies), for
providing us with the necessary resources and a conducive environment for learning and
development. His leadership and vision have been instrumental in fostering innovation
and creativity in our academic journey.

Finally, I am deeply grateful to Dr. Avneesh Vashistha, Head of Department CSE


(Computer Science and Engineering), for providing us with this opportunity to build and
present our project and for always motivating us to strive for excellence. His belief in our
capabilities has inspired us to reach new heights.

This project would not have been possible without the collective efforts and guidance of
these esteemed individuals, and I extend my sincere appreciation to each one of them.
INTRODUCTION
The Quiz Game is a console-based program written in C, aimed at providing an
interactive way for players to challenge their knowledge. The game features a simple
interface where users can navigate between different options such as starting the game,
viewing the highest score, resetting the score, or quitting the game.

Key features include:

● Warmup Round: Players must answer at least three out of five questions
correctly to proceed.
● Challenge Round: Players answer 10 questions, each worth 100,000 points.
● Score Tracking: The game records and displays the highest score in the system,
adding a competitive element to gameplay.
● File Handling: The program uses file operations to store and retrieve the highest
score.

The primary goal is to reinforce core C programming concepts and show how they can
be used to build interactive console applications.

REQUIREMENTS
C Compiler: A C compiler such as:

● GCC (GNU Compiler Collection)


● Turbo C (for legacy systems)
● Any modern Integrated Development Environment (IDE) with C support (e.g.,
Code::Blocks, Dev C++)

Text Editor: For writing the code, use:

● Visual Studio Code


● Sublime Text
● Notepad++
● Turbo C IDE (for older systems)

Hardware Requirements:

● Processor: At least Intel i3 or equivalent


● RAM: Minimum 2 GB for smooth execution
● Storage: 100 MB of available space for storing the program files
● Operating System: Windows, Linux, or macOS
IMPLEMENTATION

Game Structure and Flow

● Main Function: The entry point of the program is the main function, where the game
starts. It initialises the necessary variables, displays the main menu, and controls the
game flow based on user input.
● Game Loop: The main loop continues running until the player decides to quit. It
offers options to start the game, view the highest score, reset the score, or exit the
program.

Displaying the Main Menu

● Menu Options: When the game starts, the main menu is displayed using printf
statements. The user can choose one of the following options:
○ S: Start the game.
○ V: View the highest score.
○ R: Reset the score.
○ H: Help (instructions).
○ Q: Quit the game.
● User Input: The program captures the user's input using the getch() function,
which allows for immediate character reading without needing to press Enter.

Warmup Round

● Purpose: The warmup round serves as a qualification stage. Players must answer at
least three out of five questions correctly to advance to the challenge round.
● Question Display: Questions are displayed using printf, and the player's answers
are collected with getch(). The user's response is checked against the correct
answer, and the count of correct answers is updated accordingly.
● Qualification Check: After answering the questions, the program checks if the
player has answered at least three correctly. If not, the game prompts them to try
again.

Challenge Round

● Main Gameplay: Upon qualifying from the warmup round, players enter the
challenge round, where they answer a series of ten questions.
● Question Loop: A loop iterates through the questions, displaying them and checking
the user's answers similarly to the warmup round. Each correct answer adds points
to the player's score.
● Scoring System: Each question in the challenge round is worth a specified number
of points. The total score is calculated based on the number of correct answers.
Score Management

● Displaying the Highest Score: The program uses file handling to read the highest
score from a file (score.txt). If the file contains a score, it is displayed to the user.
● Updating the Score: If the player's final score exceeds the previously recorded
highest score, the program updates the file with the new score, along with the
player's name.
● Resetting the Score: The option to reset the highest score allows users to clear the
stored score, facilitating a fresh start for new players or returning players who want to
compete again.

File Handling

● Opening and Reading Files: The program opens the score.txt file for reading
the current highest score using the fopen() function. The fscanf() function reads
the contents into appropriate variables.
● Writing to Files: When updating the high score, the program opens the same file in
write mode ("w"), writing the new score and player name using fprintf().
● Closing Files: After file operations are completed, the program closes the file using
fclose() to ensure data integrity and prevent file corruption.

End of Game

● Program Termination: The game can be terminated by selecting the quit option from
the main menu. Upon quitting, the program exits gracefully, ensuring all resources
are released properly.
CODE
Main Menu:

Displays options for starting the game, viewing the highest score, resetting the score, or
quitting the game.

Warmup Round Question:

This section verifies if the user qualifies for the challenge round.

Challenge Round Question:

This code snippet showcases a question from the challenge round.


Displaying the Highest Score:

This code reads from a file to display the highest score.

Updating the Score:

This snippet updates the score if the player exceeds the previous high score.
RESULTS

User Experience Enhancements

● Feedback Mechanism: Throughout the game, feedback is provided to the user,


such as correct answer confirmations and scores, enhancing engagement.
● Input Handling: The program checks for valid input and handles unexpected
characters by prompting the user again, ensuring a smooth experience.

Future Enhancements

● Question Variety: To improve the game, more diverse questions can be added, and
categories can be introduced for a richer experience.
● User Interface: The console UI could be improved with better formatting and
perhaps a graphical interface for advanced implementations.
● Multiplayer Option: A multiplayer mode could be introduced, allowing players to
compete against each other in real-time.

Output
Main Menu:

Warmup Round Question:


Challenge Round Question:

Highest Score Display:


CONCLUSION
The Quiz Game in C successfully demonstrates how a simple text-based game can be
created using core C programming concepts. It is an engaging way for players to test their
knowledge while introducing programmers to topics such as:

● Conditional statements and loops


● File handling for persistent data storage
● Basic game logic for scoring and question evaluation

This project highlights how these fundamental principles can be used to create interactive,
real-world applications. Future improvements could include adding more questions,
improving the user interface, and creating more advanced gameplay mechanics.

You might also like