A Project Report on
“MATH QUEST” QUIZ GAME USING C++
BACHELOR OF COMPUTER APPLICATION
By
MASTER DEBESH KARUA
AJU/230047
Under the guidance of
Ms. Divya Paikaray
(Assistant Professor)
&
Dr. Arvind Kumar Pandey
(Dean)
ARKA JAIN UNIVERSITY, JHARKHAND
DEPARTMENT OF COMPUTER SCIENCE & INFORMATION TECHNOLOGY
AUGUST-2023
ABSTRACT
"Math Quest" is an interactive quiz game developed using C++ that aims to enhance mathematical knowledge
and problem- solving skills in an engaging and entertaining format. The project is designed to challenge players
with a variety of math- related questions, ranging from basic arithmetic to algebra and geometry, catering to
different skill levels. The game incorporates features such as different levels and score tracking to provide a
comprehensive learning experience. Through its user-friendly interface, "Math Quest" not only serves as an
educational tool but also as a fun activity that encourages players to test and improve their mathematical
abilities. This project demonstrates the application of C++ programming skills in creating an effective and
enjoyable educational game.
3
ACKNOWLEDGEMENT
I would like to extend my sincere thanks to Prof. Ms. Divya Paikaray for her unwavering support and insightful
guidance throughout the development of my quiz game project, "Math Quest". Her expertise and constructive
feedback were crucial in shaping the project. I also wish to express my deep appreciation to Dr. Arvind Kumar
Pandey, Head of the Department, for his overall supervision and encouragement. His leadership and dedication
greatly contributed to the successful completion of this project. I am grateful for their invaluable contributions
and support. This project would not have been possible without their support and mentorship.
4
CONTENTS
LISTOFCONTENTS PAGENO.
INTRODUCTION 7
SPECIFICATION USED 8
CODE 9-15
OUTPUT 16-18
CONCLUSION 19
REFERENCE 20
6
INTRODUCTION
"Math Quest" is an innovative and interactive quiz game developed using C++ designed to enhance
mathematical skills and provide a stimulating learning experience. In an era where educational tools and
technologies are rapidly evolving, this project aims to bridge the gap between learning and entertainment by
creating a game that challenges players with a variety of math problems. The primary objective of "Math
Quest" is to engage users in a fun and educational environment where they can test and improve their
mathematical knowledge. The game features a range of questions that cover different mathematical concepts,
including arithmetic, algebra, and geometry. It incorporates multiple difficulty levels to cater to players of
varying expertise, providing a tailored experience for both beginners and advanced users. Through this project,
I have utilized C++ programming techniques to develop a robust and user-friendly application. The game
includes features such as timed quizzes, score tracking, and feedback mechanisms, which are designed to
motivate players and enhance their learning experience. "Math Quest" not only serves as a valuable educational
tool but also demonstrates the practical application of C++ in developing engaging software solutions. This
project reflects my commitment to leveraging technology to create effective learning platforms and showcases
my skills in software development.
7
SPECIFICATION
1. Used Hardware Configuration List
➢ Processor-13th Gen Intel(R) Core (TM) i7-13700H 2.40 GHz
➢ RAM-16.0GB
➢ Storage - Disk SSD 1TB
2. Used Software list
➢ Visual Studio Code - for code execution
➢ Microsoft Office (Word) - for project file presentation
3. Operating system
➢ Window 11 version 23H2
8
CODE
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
string userName; // Global variable to store the user's name
// Project by Hiranmay Guchhait & Master Debesh Karua
void easyMath() //Easy level
{
int ans[5], skipCount = 0, ansCount = 0, correctAns = 0;
int answer[5] = {2, 779, 119, 300, 4};
string ques[5] = {
"Q1) 1+1=_?", "Q2) 999-33-87-100=___?", "Q3) What is 72+47?",
"Q4) To stay in a hotel cost Rs.100 per night. You stay for three nights and
check out on the fourth morning. How much will you pay?", "Q5) If X+Y=6, and
Y+1=3, what is X?"};
cout << "\n**************** Welcome To Level Easy ****************" <<
endl;
cout << ":::::: Instructions ::::::" << endl;
cout << "Enter your answers after the questions asked\nYou may skip
questions by entering 0." << endl;
tryagain:
for (int i = 0; i < 5; i++)
{
cout << ques[i] << endl;
cin >> ans[i];
if (ans[i] != 0)
{
ansCount++;
if (ans[i] == answer[i])
{
correctAns++;
cout << "Correct Answer!" << endl;
}
else
{
cout << "Wrong Answer!" << endl;
cout << "Answer = " << answer[i] << endl;
}
}
9
else
{
skipCount++;
cout << "Answer = " << answer[i] << endl;
}
}
if (correctAns >= 3)
{
cout << " Congratulations, " << userName << "! You have completed
this level.\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions.\n" << endl;
}
else
{
cout << " You Failed, " << userName << "! Try again!!!\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions.\n" << endl;
goto tryagain;
}
}
void mediumMath() //Medium level
{
int ans[5], skipCount = 0, ansCount = 0, correctAns = 0;
int answer[5] = {-1000, 300, 200, 5, 40};
string ques[5] = {
"Q1) Subtract -999-10+9?", "Q2) A plane travels 900 kilometers in 3 hours.
What is the average speed of the plane in kilometers per hour?", "Q3) A car
travels 150 kilometers in 3 hours. How far does the car travel in 4 hours at the
same average speed?",
"Q4) Solve for x in the equation 3x+7=22", "Q5) If a rectangle has a length
of 8 units and a width of 5 units, what is its area?"};
cout << "\n**************** Welcome To Level Medium ****************"
<< endl;
cout << ":::::: Instructions ::::::" << endl;
10
cout << "Enter your answers after the questions asked\nYou may skip questions
by entering 0." << endl;
tryagain:
for (int i = 0; i < 5; i++)
{
cout << ques[i] << endl;
cin >> ans[i];
if (ans[i] != 0)
{
ansCount++;
if (ans[i] == answer[i])
{
correctAns++;
cout << "Correct Answer!" << endl;
}
else
{
cout << "Wrong Answer!" << endl;
cout << "Answer = " << answer[i] << endl;
}
}
else
{
skipCount++;
cout << "Answer = " << answer[i] << endl;
}
}
if (correctAns >= 3)
{
cout << " Congratulations, " << userName << "! You have completed
this level.\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions." << endl;
}
else
11
{
cout << " You Failed, " << userName << "! Try again!!!\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions." << endl;
goto tryagain;
}
}
void hardMath() //Hard level
{
int skipCount = 0, ansCount = 0, correctAns = 0;
double ans[5], answer[5] = {3, 35, 64, 573.01, 4};
string ques[5] = {
"Q1) 27 is a perfect cube. If true then what is the perfect cube of 27?", "Q2)
If the mean of frequency distribution is 7.5 and ∑fi xi = 120 + 3k, ∑fi = 30, then k
is equal to:", "Q3) In a javelin throw, an athlete threw the javelin three times
with distances of x meters,1.5x meters,0.8x meters. If the average distance of the
throw is 70 meters find the value of x",
"Q4) 90+33+0.01+100+241+101+8=___?", "Q5) If AM of a, a+3, a+6, a+9
and a+12 is 10, then a is equal to ?"};
cout << "\n**************** Welcome To Level Hard ****************" <<
endl;
cout << ":::::: Instructions ::::::" << endl;
cout << "Enter your answers after the questions asked\nYou may skip
questions by entering 0." << endl;
// Set console code page to UTF-8 for the input of special symbol
SetConsoleOutputCP(CP_UTF8);
tryagain:
for (int i = 0; i < 5; i++)
{
cout << ques[i] << endl;
12
cin >> ans[i];
if (ans[i] != 0)
{
ansCount++;
if (ans[i] == answer[i])
{
correctAns++;
cout << "Correct Answer!" << endl;
}
else
{
cout << "Wrong Answer!" << endl;
cout << "Answer = " << answer[i] << endl;
}
}
else
{
skipCount++;
cout << "Answer = " << answer[i] << endl;
}
}
if (correctAns >= 3)
{
cout << " Congratulations, " << userName << "! You have completed this
level.\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions." << endl;
}
else
{
cout << " You Failed, " << userName << "! Try again!!!\n" << endl;
cout << "Total no. of questions asked = 5." << endl;
cout << "You have answered " << correctAns << " correctly!" << endl;
13
cout << "You have given " << (5 - correctAns - skipCount) << " wrong
answers." << endl;
cout << "You have skipped " << skipCount << " questions.\n" << endl;
goto tryagain;
}
}
int main()
{
// Set console code page to UTF-8 for the special symbol
SetConsoleOutputCP(CP_UTF8);
// color of the terminal
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_RED |
FOREGROUND_GREEN |
FOREGROUND_INTENSITY |
BACKGROUND_GREEN);
// clear terminal
system("cls");
// Prints the starting heading
cout << "\n---------------------- Welcome to Math Quiz Game by Hiranmany &
Master ----------------------\n" << endl;
// User name
cout << "Enter your name: ";
cin >> userName;
int level;
char ch;
lvl:
cout << "---------------------- Welcome To Math Quiz Game ----------------------"
<< endl;
cout << "Choose your level of playing the game!!" << endl;
cout << "1)Easy \n2)Medium \n3)Hard" << endl;
cin >> level;
switch (level)
{
case 1:
cout << "---------------------- Easy Level Quiz ----------------------" << endl;
easyMath();
14
break;
case 2:
cout << "---------------------- Medium Level Quiz ----------------------" << endl;
mediumMath();
break;
case 3:
cout << "---------------------- Hard Level Quiz ----------------------" << endl;
hardMath();
break;
default:
cout << "You have entered an invalid input. Please choose again!!" << endl;
goto lvl;
break;
}
cout << endl;
cout << "Do you wanna play again?\nInput y for yes and n for no." << endl;
cin >> ch;
if (ch == 'y' || ch == 'Y')
{
goto lvl;
}
else
{
cout << "\n\n-----------!!Come later again to play!!-----------\n\n";
}
return 0;
} // by Hiranmay & Master
15
OUTPUT
Easy Level
Playing Again
16
Medium Level
Hard Level
17
Wrong answer
18
CONCLUSION
In conclusion, the development of "Math Quest" has been a rewarding and educational experience, showcasing
the effective use of C++ programming to create an engaging and interactive quiz game. This project has
successfully met its objectives by providing a platform for players to challenge and enhance their mathematical
skills in a stimulating environment. Through the incorporation of various features such as timed quizzes, score
tracking, and multiple difficulty levels, "Math Quest" has demonstrated its potential as both an educational
tool and a source of entertainment. The development process has not only honed my programming skills but
also highlighted the importance of user experience in creating effective learning solutions. I believe that "Math
Quest" stands as a testament my ability to apply theoretical knowledge in a practical context, and I proud of
the outcome achieved. This project underscores my commitment to leveraging technology to facilitate learning
and underscores the potential for future advancements and improvements. I hope that "Math Quest" will serve
as a valuable resource for users seeking to improve their mathematical abilities while enjoying an interactive
gaming experience.
19
REFERENCE
1. Object Oriented Analysis and Design by Balaguruswamy, Tata McGraw Hill (2017).
2. Mastering C++ by K R Venugopal, Rajkumar Buyya, T Ravishankar, Tata McGrawHill (2017).
3. Programming: Principles and Practice Using C++ (2nd ed.) by Addison-Wesley Bjarne
Stroustrup. (2020).
4. Visual Studio Code Documentation by Microsoft. (2023).
5. Beginning C++ Through Game Programming 3rdEdition by Michael Dawson 3rd
Edition (2010).
6. C++ Primer (5th Edition) by Josée Lajoie and Stanley B. Lippman 5th Edition (2012).
7. Basics with Windows Command prompt- A to N by Prometheus MMS (2019).
8. The C++ Programming Language (4th ed.) by Addison-Wesley Stroustrup, B. (2013).
9. A Complete Guide to Programming in C++ by Ulla Kirch-Prinz 1st Edition (2001).
10. C++: The Complete Reference (5th ed.) by McGraw-Hill Education Schildt, H. (2017).
20