Professional Documents
Culture Documents
SCIENCE
PROJECT
IT’S QUIZ TIME!!!
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++
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
5|Page
HARDWARE REQUIREMENTS
PC 286 or above
VGA Adapter
4MB RAM
SOFTWARE REQUIREMENTS
MS DOS version 5 or above
Windows 98 or above
6|Page
DATA DIRECTORY
HEADER FILES
fstream.h
conio.h
ctype.h
stdio.h
process.h
dos.h
string.h
FUNCTIONS USED
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.
8|Page
FLOWCHART
MAIN DATABASE
LOGIN INSTRUCTIONS
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();
}
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;
}
}
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:
18 | P a g e
BIBILIOGRAPHY
Computer science with C++ for class 12
www.computerprojects.com
19 | P a g e
20 | P a g e