Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Contents
Page
No.
1.
2.
3.
4.
5.
6.
7.
Abstract...2
Introduction.....................3
System Requirements 4
Coding5
Output Screenshots20
Conclusion.24
Bibliography. 25
ABSTRACT
The project entitled Online Examination System is developed
using the programming language C++.
The project aims at simplifying a teachers job of creating and
checking the results of the students. The teacher can manage the examinations
details present for the students. The teacher can set the Questions with five
choices and the questions will be displayed to the students at the time of
examination. The number of correct answers is displayed at the last. It also
helps students to access tests easily and get immediate test reports.
INTRODUCTION
SYSTEM REQUIREMENTS
Hardware:
1. Processor : IntelCore2 Duo CPU E4500@ 2.20 GHz
2. RAM : 1024 MB
3. Hard Disk : 150GB
Software:
1. Windows XP Operating system
2. Turbo C++
CODING
#include<fstream.h>
#include<dos.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class EXAM
{
struct QUESTION
{
char que[500];
char fians[100];
char sans[100];
char tans[100];
char foans[100];
char nans[100];
int ans[5],anss;
}question;
struct SECURITY
{
char uname[20];
Computer science investigatory projectPage 5
char pass[20];
}security;
fstream file;
public:
void writequestion();
void readdata();
void takeexam();
void writenewexam();
void makeusername();
void changepassword();
int checkpassword();
int returnminute();
};
void EXAM::makeusername()
{
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::beg);
cout<<"\n ENTER THE USERNAME :"<<" ";
gets(security.uname);
cout<<"\n ENTER THE PASSWORD :"<<" ";
gets(security.pass);
file.write((char *)&security,sizeof(security));
file.close();
Computer science investigatory projectPage 6
}
void EXAM::changepassword()
{
char ouname[20],opass[20];
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
cout<<"\n ENTER THE OLD USERNAME :"<<" ";
gets(ouname);
cout<<"\n ENTER OLD PASSWORD :" <<" ";
gets(opass);
file.read((char *)&security,sizeof(security));
if((strcmp(ouname,security.uname)==0)&&(strcmp(opass,security.pass)==0))
{
file.seekp(0L,ios::beg);
cout<<"\n ENTER NEW USERNAME :"<<" ";
gets(security.uname);
cout<<"\n ENTER THE PASSWORD :"<<" ";
gets(security.pass);
file.write((char *)&security,sizeof(security));
}
else
cout<<"\n USER DOES NOT EXIST ";
file.close();
Computer science investigatory projectPage 7
}
int EXAM::checkpassword()
{
int flag;
char ouname[20],opass[20];
file.open("examsecurity.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
cout<<"\n ENTER THE USERNAME :"<<" ";
gets(ouname);
cout<<"\n ENTER PASSWORD :" <<" ";
gets(opass);
file.read((char *)&security,sizeof(security));
if((strcmp(ouname,security.uname)==0)&&(strcmp(opass,security.pass)==0))
flag=1;
else
flag=0;
file.close();
if(flag==1)
return 1;
else
return 0;
}
void EXAM::writequestion()
{
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::end);
cout<<"\n Enter the question:"<<" ";
gets(question.que);
cout<<"\n Enter the first option:"<<" ";
gets(question.fians);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[0];
if(question.ans[0]==1)
question.anss=question.ans[0];
cout<<"\n Enter the second option:"<<" ";
gets(question.sans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[1];
if(question.ans[1]==1)
question.anss=question.ans[1];
cout<<"\n Enter the third option:"<<" ";
gets(question.tans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[2];
if(question.ans[2]==1)
Computer science investigatory projectPage 9
question.anss=question.ans[2];
cout<<"\n Enter the fourth option:"<<" ";
gets(question.foans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[3];
if(question.ans[3]==1)
question.anss=question.ans[3];
cout<<"\n Enter last option:"<<" ";
gets(question.nans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[4];
if(question.ans[4]==1)
question.anss=question.ans[4];
file.write((char *)&question,sizeof(question));
cout<<"\n Questions Created Successfully... ";
file.close();
clrscr();
}
void EXAM::writenewexam()
{
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekp(0L,ios::beg);
cout<<"\n Enter the question:"<<" ";
Computer science investigatory projectPage 10
gets(question.que);
cout<<"\n Enter the first option:"<<" ";
gets(question.fians);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[0];
if(question.ans[0]==1)
question.anss=question.ans[0];
cout<<"\n Enter the second option:"<<" ";
gets(question.sans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[1];
if(question.ans[1]==1)
question.anss=question.ans[1];
cout<<"\n Enter the third option:"<<" ";
gets(question.tans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[2];
if(question.ans[2]==1)
question.anss=question.ans[2];
cout<<"\n Enter the fourth option:"<<" ";
gets(question.foans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[3];
Computer science investigatory projectPage 11
if(question.ans[3]==1)
question.anss=question.ans[3];
cout<<"\n Enter last option:"<<" ";
gets(question.nans);
cout<<"\n Is it correct answer? \n if yes press 1 else 2"<<" ";
cin>>question.ans[4];
if(question.ans[4]==1)
question.anss=question.ans[4];
file.write((char *)&question,sizeof(question));
cout<<"\n New Exam Created Successfully... ";
file.close();
clrscr();
}
void EXAM::readdata()
{
int count;
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
while(file.read((char *)&question,sizeof(question)))
{
count=0;
cout<<"\n"<<question.que<<"\n";
Computer science investigatory projectPage 12
cout<<"1)"<<question.fians;
cout<<"\n2)"<<question.sans;
cout<<"\n3)"<<question.tans;
cout<<"\n4)"<<question.foans;
cout<<"\n5)"<<question.nans;
for(int i=0;i<5;i++)
{
++count;
if(question.ans[i]==1)
cout<<"\n Answer is option "<<count;
}
cout<<"\n--------\n";
}
file.close();
}
void EXAM::takeexam()
{
int min;
int ch,p=0,count,c;
min=returnminute();
file.open("exam.txt",ios::binary|ios::in|ios::out);
file.seekg(0L,ios::beg);
Computer science investigatory projectPage 13
while(file.read((char *)&question,sizeof(question)))
{
count=0;
cout<<"\n"<<question.que<<"\n";
cout<<"1)"<<question.fians;
cout<<"\n2)"<<question.sans;
cout<<"\n3)"<<question.tans;
cout<<"\n4)"<<question.foans;
cout<<"\n5)"<<question.nans;
for(int i=0;i<5;i++)
{
++count;
if(question.ans[i]==1)
{
c=count;
}
}
cout<<"\n Enter your answer number:"<<" ";
cin>>ch;
if(ch==c)
{
++p;
}
Computer science investigatory projectPage 14
cout<<"\n--------";
clrscr();
cout<<"
int EXAM::returnminute()
{
struct time t;
gettime(&t);
printf("Time is: %2d:%02d:%02d.%02d\n",
t.ti_hour, t.ti_min, t.ti_sec, t.ti_hund);
return(t.ti_min);
}
void main()
{
int ch,ch1;
Computer science investigatory projectPage 15
EXAM exam;
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
cout<<" \t\t\t|| WELCOME TO YOUR DASHBOARD || ";
do
{
cout<<"\n 1.Teacher \n 2.Student \n 3.Exit";
cout<<"\n Enter your choice:"<<" ";
cin>>ch;
switch(ch)
{
case 1:
clrscr();
cout<<"
\n\t\t
cout<<" \t\t\t-------------------------------"<<endl;
if(exam.checkpassword())
clrscr();
cout<<" \n\n\t";
do
{
cout<<"\t\t|| ONLINE EXAMINATION SYSTEM ||"<<endl;
cout<<"\t\t\t-------------------------------"<<endl;
Computer science investigatory projectPage 16
cout<<" \t\t\t-------------------------------"<<endl;
exam.writequestion();
break;
case 2:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
exam.readdata();
break;
case 3:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
exam.writenewexam();
break;
case 4:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
exam.makeusername();
break;
case 5:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
exam.changepassword();
break;
case 6:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
clrscr();
break;
}
}while(ch1!=6);
Computer science investigatory projectPage 18
break;
case 2:
clrscr();
cout<<"
cout<<" \t\t\t-------------------------------"<<endl;
cout<<"\n EXAM STARTS ...\n ALL THE BEST !! "<<" "<<endl;
exam.takeexam();
cout<<" \n END OF EXAM ... "<<endl;
break;
case 3:
break;
}
}while(ch!=3);
}
Output screens
Home Page:
Dash board:
Teacher hub:
Computer science investigatory projectPage 20
CONCLUSION
The online examination system has many advantages of which some are :
Eco Friendly
Efficient
Quick results
Reduces manual labour
Security
BIBLIOGRAPHY