You are on page 1of 20

COMPUTER

SCIENCE
PROJECT
IT’S QUIZ TIME!!!

Submitted by: Aakash Athiyarath| Class: 12-c|Roll No: 01


Ppp
ge
ACKNOWLEDGEMENTS
I place on record my sincere thanks and gratitude to our
principal Smt. Shobha Menon and our Vice Principal Smt. Usha
Prem for permitting me avail the requisite facilities for our
successful completion of this project.

I also profuse thanks ban boundless gratitude to my


teachers Smt. Malini Suresh and Smt. Sheeja M for their valuable
guidance for the successful completion of this earnest
endeavour.

I also express my gratitude to all my classmates, who


conveyed their thoughts and ideas for the improvisation of this
assignment.

2|Page
INDEX
INTRODUCTION 04

SYNOPSIS 05

HARDWARE REQUIREMENTS 06

SOFTWARE REQUIREMENTS 06

DATA DIRECTORY 07

END USER 08

FLOW CHART 09

PROGRAM CODE 10

OUTPUT SCREEN 17

BIBILIOGRAPHY 19

3|Page
INTRODUCTION
This project ‘IT’S QUIZ TIME!!!’ has been written in Turbo
C++ one of the most advanced programming languages available
today.

ABOUT C++

C++ is an object oriented program language. Object oriented


programming language is regarded as the ultimate paradigm for
the modelling of the real world information. Bjarne stroustrup
developed C++in AT&T bell laboratories in the earlier eighties. It
is the super set of programming language C. Ever since C++
originated, it has helped the users to overcome many of the
problems faced by them.

4|Page
SYNOPSIS
Our program is developed is developed in C++ language, in
order to make it more interesting and exciting. This program is
neatly intended and remarked to make its users contented and
happy. In this program we provide a game which provides a
podium to:

Play

Upload and display the questions in the admin menu,


which can be accessed only using password.

This program is mainly to test your speed, intellect and


knowledge. This project can provide leisure time to people. With
this minimal modification this program can be made useful to
various other day to day life purposes.

The modern world which is full of worries and tensions,


anything that makes life better and easy readily accepted.

5|Page
HARDWARE REQUIREMENTS
PC 286 or above

VGA Adapter

4MB RAM

SOFTWARE REQUIREMENTS
MS DOS version 5 or above

Turbo C++ version 3.0

Windows 98 or above

6|Page
DATA DIRECTORY
HEADER FILES

fstream.h
conio.h
ctype.h
stdio.h
process.h
dos.h
string.h

DATA FILES USED

QUI.DAT: To store the uploaded question and display them


in the game.

FUNCTIONS USED

void intro(): Displays the introductory part of the game.


void input(): To input the details of the player.
void rules(): Displays the rules of the game.
void cheque(): To display the cheque once the player wins
the game.
void upload(): To upload the questions to the file.
void play(): To play the game.
void menu(): Function for the main database.
void display(): To display the uploaded questions.
void kbcadmin(): To access the admin menu.

7|Page
END USER
The user can enter the details and can play the game. They
can automatically exit from the game once they give an incorrect
answer.

The admin provides the facility for the admin to log in


using a password and can change the question after each game,
so that he/she can present a new game for every player.

8|Page
FLOWCHART

MAIN DATABASE

ADMIN PLAY EXIT

LOGIN INSTRUCTIONS

UPLOAD DISPLAY GAME

RESULT

9|Page
PROGRAM CODE
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
#include<process.h>
#include<dos.h>
#include<string.h>
//CLASS WHICH CONTAINS ALL THE VARIABLES AND FUNCTIONS
class questions
{
char q[150],a1[25],a2[25],a3[25],a4[25],r;
public:
void intro();
void input();
void IQTadmin();
void rules();
void cheque();
void upload();
void play();
void menu();
void display();
}ques;
void questions::intro() //INTRODUCTORY FUNCTION
{
textcolor(GREEN);
cprintf("\n\n IT'S QUIZ TIME!!!");
textcolor(WHITE);
cout<<"\n\n\n\n Press any key to continue...";
getch();
}
char name[15],place[15];
void questions::input()
{
textbackground(4);
textcolor(WHITE);
cout<<" Welcome to IT'S QUIZ TIME!!!...\n";
cout<<"\n\n Please enter your details:";
cout<<"\n\n NAME:";
gets(name);
cout<<"\n\n PLACE:";

10 | P a g e
gets(place);
clrscr();
cout<<" IT'S QUIZ TIME!!!";
cout<<"\n\n Welcome: "<<name<<"\n\n From: "<<place;
char*p="\n\n Press any key to continue...";
cout<<p;
getch();
clrscr();
}
void questions::rules()
{
cout<<"\n Rules: ";
cout<<"\n\n =>There are total 13 questions";
cout<<"\n\n =>First question is worth Rs.5000";
cout<<"\n\n =>With the correct answer of each question the amount doubles";
cout<<"\n\n =>Question 13 is the jackpot worth Rs.5 Crore";
char*p="\n\n\n Press any key to continue...";
cout<<p;
getch();
}
void questions::cheque() //TO DISPLAY CHEQUE
{
textbackground(0);
clrscr();
delay(2000);
cout<<"\n";
for(int z=1;z<=79;z++)
{
cout<<"=";
}
cout<<endl;
for(int i=1;i<=20;i++)
{
cout<<"|";
for(int j=0;j<=77;j++)
{
cout<<" ";
}
cout<<"|"<<endl;
}
for(int y=1;y<=79;y++)
{
cout<<"=";
}

11 | P a g e
cout<<endl;
gotoxy(30,3);
cout<<"IT'S QUIZ TIME WINNER";
gotoxy(5,5);
cout<<"NAME :"<<name;
gotoxy(5,7);
cout<<"RUPEES : 2 CRORE";
gotoxy(5,9);
cout<<"FROM :"<<place;
gotoxy(63,9);
textcolor(WHITE);
textbackground(WHITE);
cprintf("Rs.2,00,00,000");
gotoxy(32,20);
cout<<"CONGRATULATIONS!!!";
char*p="\n\n\n\n Press any key to continue";
cout<<p;
getch();
menu();
}
void questions::menu() //MAIN MENU
{
textbackground(GREEN);
clrscr();
textcolor(WHITE);
cout<<"\n\n ********MAIN MENU********";
cout<<"\n\n\n 1.ADMIN";
cout<<"\n 2.PLAY";
cout<<"\n 3.EXIT";
int choice;
cout<<"\n\n\n Enter your choice_____(1-3)";
cin>>choice;
switch(choice)
{
case 1:IQTadmin();
break;
case 2:play();
break;
case 3:exit(0);
break;
}
}
void questions::upload() //FUNCTION TO UPLOAD QUESTIONS TO FILE
{

12 | P a g e
clrscr();
char choice;
ofstream fout("QUI.dat",ios::app);
for(int i=0;i<13;i++)
{
cout<<"\n IT'S QUIZ TIME ADMIN";
cout<<"\n\n Enter questions to be uploaded\n q"<<i+1<<":";
gets(ques.q);
cout<<"\n Enter options \n";
cout<<"\n a)";
gets(ques.a1);
cout<<"\n b)";
gets(ques.a2);
cout<<"\n c)";
gets(ques.a3);
cout<<"\n d)";
gets(ques.a4);
cout<<"\n Enter correct option: ";
cin>>ques.r;
fout.write((char*)&ques,sizeof(ques));
clrscr();
}
fout.close();
menu();
}

void questions::IQTadmin() //ADMIN MENU


{
char pwd[10];
int choice;
textbackground(5);
textcolor(WHITE);
clrscr();
cout<<"\n\n IT'S QUIZ TIME ADMIN";
cout<<"\n\n ENTER PASSWORD:";
cin>>pwd;
if(strcmp(pwd,"******"))
{
cout<<"\n\n\n WRONG PASSWORD";
cout<<"\n PRESS 1 TO TRY AGAIN";
cout<<"\n PRESS 2 TO GO TO MAIN MENU:";
cin>>choice;
if(choice==1)

13 | P a g e
IQTadmin();
else
menu();
}
clrscr();
cout<<"\n\n IT'S QUIZ TIME ADMIN";
cout<<"\n\n 1.UPLOAD QUESTIONS";
cout<<"\n\n 2.DISPLAY QUESTIONS";
cout<<"\n\n 3.MAIN MENU";
cout<<"\n\n Choice:";
cin>>choice;
switch(choice)
{
case 1:upload();
break;
case 2:display();
break;
case 3:menu();
break;
}
}

void questions::display() //FUNCTIONS TO DISPLAY QUESTIONS IN ADMIN MENU


{
int i=0;
char p[150],c1[25],c2[25],c3[25],c4[25],ans;
ifstream fin("QUI.dat",ios::binary);
while(fin.eof()==0&&i<13)
{
clrscr();
fin.read((char*)&ques,sizeof(ques));
strcpy(p,ques.q);
strcpy(c1,ques.a1);
strcpy(c2,ques.a2);
strcpy(c3,ques.a3);
strcpy(c4,ques.a4);
ans=ques.r;
cout<<" IT'S QUIZ TIME!!!";
cout<<"\n\n"<<i+1<<" ";
puts(p);
cout<<"\n Options are : \n a)";
puts(c1);
cout<<"\n b)";
puts(c2);

14 | P a g e
cout<<"\n c)";
puts(c3);
cout<<"\n d)";
puts(c4);
cout<<"\n Correct Option : "<<ans;
i++;
if(i<13)
cout<<"\nPress any key for the next question : ";
else
cout<<"\nPress any key for admin page : ";
getch();
}
IQTadmin();
}
void questions::play()
{
textbackground(0);
clrscr();
input();
clrscr();
rules();
clrscr();
long am=0;
int i=0;
char p[150],c1[25],c2[25],c3[25],c4[25],ans;
ifstream fin("QUI.dat",ios::binary);
while(fin.eof()==0&&i<13)
{
fin.read((char*)&ques,sizeof(ques));
strcpy(p,ques.q);
strcpy(c1,ques.a1);
strcpy(c2,ques.a2);
strcpy(c3,ques.a3);
strcpy(c4,ques.a4);
cout<<"\n IT'S QUIZ TIME!!!\n\n";
if(am==0)
cout<<"\n Question amount : Rs.5000 \t In hand : Rs.0";
else
cout<<"\n Question amount : Rs."<<am*2<<" \t In hand : Rs."<<am;
cout<<"\n\n Q)";
puts(p);
cout<<"\n Options are :\n\n a)";
puts(c1);
cout<<"\n b)";

15 | P a g e
puts(c2);
cout<<"\n c)";
puts(c3);
cout<<"\n d)";
puts(c4);
cout<<"\n\n Enter your answer :";
cin>>ans;
ans=tolower(ans);
if(ques.r==ans)
{
cout<<"\n YES!!!!! Thats the correct answer!!";
if(am==0)
am=5000;
else
am=2*am;
cout<<"\n YOU WIN Rs ."<<am;
char*p="\n\n Press any key to continue :";
cout<<p;
getch();
clrscr();
}
else
{
cout<<"\n NO.....ITS WRONG \n\nCorrect option is"<<ques.r;
cout<<"\n\n You take back an amount of Rs. : "<<am;
char*p="\n\n Press any key to continue : ";
cout<<p;
getch();
menu();
}
i++;
}
cheque();
}
void main()
{
textbackground(0);
clrscr();
ques.intro();
clrscr();
ques.menu();
getch();
}

16 | P a g e
OUTPUT SCREEN
MAIN MENU:

ADMIN MENU:

UPLOADING A QUESTION

DISPLAYING A QUESTION

17 | P a g e
PLAYING THE GAME:

.........INSTRUCTIONS ASKING QUESTIONS

DISPLAYING THE WINNER’S


CHEQUE AFTER THE LAST
QUESTION

18 | P a g e
BIBILIOGRAPHY
Computer science with C++ for class 12

Reference in C++ by Sumita Arora for class 12

www.computerprojects.com

19 | P a g e
20 | P a g e

You might also like