Description:
This Project is like simple MCQ's exam system on computers. It can be used for online Exam system.
INSTRUCTIONS:
This Project is like simple MCQ's exam system on computers. It can be used for online Exam system.
INSTRUCTIONS:
- Make a folder in 'd' drive naming 'mcq'.
- In 'mcq' folder make three subfolders naming 'itc', 'itt', 'oop'.
- Then in each subfolder make 33 text doccument files . Each file contains one mcq question having three or four choices.
- Then change the part of code having answers accordingly.
CODE:
#include<iostream>
#include<conio.h>
#include<fstream>
#include<cstdlib>
#include<ctime>
#include<string>
using namespace std;
int s1;
float l=0;
char ch,ch3;
class Exam
{
protected:
char name[15];
char regno[15];
char institute[15];
public:
void home()
{
cout<<" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"<<endl;
cout<<" * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * ****** * * * * * * * * * * * * * "<<endl;
cout<<" * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" "<<endl;
cout<<"\n\n\n"<<endl;
cin>>ch3;
system("CLS");
}
virtual void getdeta()
{
system("CLS");
cout<<" *********************REGISTRATION FORM**************************"<<endl<<endl;
cout<<"Please enter your name :";
cin.getline(name,15);cout<<endl;
cout<<"Please enter your registration number:";
cin.getline(regno,15);cout<<endl;
cout<<"Please enter your institute name:";
cin.getline(institute,15);cout<<endl;
}
virtual void display()
{
cout<<"Your name is :"<<name<<endl;
cout<<"Your registration number:"<<regno<<endl;
cout<<"Your institute name is:"<<institute<<endl;
}
virtual void selection()
{
int a1;
d:
cout<<"********************Selection of subject***********************"<<endl<<endl;
cout<<"Enter 1 for OOP, 2 for ITC, 3 for ITT"<<endl;
cin>>a1;
if(a1==1)
{cout<<"Your selected subject is OOP"<<endl;
s1=5;}
else if(a1==2)
{cout<<"Your selected subject is ITC"<<endl;
s1=6;}
else if(a1==3)
{cout<<"Your selected subject is ITT"<<endl;
s1=7;}
else
{ cout<<"your entry is wrong please reenter."<<endl;
goto d;}
}
virtual void resultcard()
{
display();
cout<<"Your acquired marks are"<<endl;
cout<<l<<endl;
ofstream outfile("d:\\result.txt");
outfile<<"Name: "<<name<<endl<<"Regstration Number: "<<regno<<endl<<"Institute: "<<institute<<endl<<"Marks:"<<l<<endl;
}
};
class OOP:public Exam
{
public:
void getdeta()
{ char ch4;
system("CLS");
cout<<"***********************WELCOME*************************"<<endl<<endl;
cout<<"Negitive marking is included in exam if you want to skip a question press 'S'"<<endl<<endl;
cout<<"*********************REGISTRATION FORM**************************"<<endl<<endl;
cin.ignore();
cout<<"Please enter your name :";
cin.getline(name,15);cout<<endl;
cout<<"Please enter your registration number:";
cin.getline(regno,15);cout<<endl;
cout<<"Please enter your institute name:";
cin.getline(institute,15);cout<<endl;
}
void display()
{
cout<<"Your name is :"<<name<<endl;
cout<<"Your registration number:"<<regno<<endl;
cout<<"Your institute name is:"<<institute<<endl;
}
void selection()
{
system("CLS");
int a1;
d:
cout<<"********************Selection of subject***********************"<<endl<<endl;
cout<<"Enter 1 for OOP, 2 for ITC, 3 for ITT"<<endl;
cin>>a1;
if(a1==1)
{
cout<<"Your selected subject is OOP"<<endl;
s1=5;
}
else if(a1==2)
{
cout<<"Your selected subject is ITC"<<endl;
s1=6;
}
else if(a1==3)
{
cout<<"Your selected subject is ITT"<<endl;
s1=7;
}
else
{ cout<<"your entry is wrong please reenter."<<endl;
goto d;}
}
void resultcard()
{
display();
cout<<"Your acquired marks are"<<endl;
cout<<l<<endl;
ofstream outfile("d:\\result.txt");
outfile<<"Name: "<<name<<endl<<"Regstration Number: "<<regno<<endl<<"Institute: "<<institute<<endl<<"Marks:"<<l<<endl;
}
void infile()
{
string line;
system ("CLS");
y2:
for(int i=1;i<=10;i++)
{
// y2:
cout<<endl<<"*********************************************************** "<<endl;
cout<<"Question No."<<i<<":";
int arr1[35];
abc:
srand(time(0));
int j=1+rand()%34;
for(int k=0;k<=i;k++)
{
if (arr1[k]==j)
goto abc;
}
arr1[i]=j;
switch(j)
{
case 1:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\1.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
y1:
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
else
{ cout<<"your entry is wrong please reenter."<<endl;
goto y1;}
}
break;
}
case 2:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\2.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='c'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 3:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\3.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='b'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 4:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\4.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='b'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 5:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\5.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='b'||ch=='c')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 6:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\6.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='c'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 7:
{
string line;
ifstream myfile ("d:\\mcqs\\oop\\7.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;
}
else if (ch=='c'||ch=='a')
{
l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;
}
}
break;
}
case 8:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\8.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 9:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\9.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 10:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\10.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 11:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\11.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 12:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\12.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 13:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\13.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 14:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\14.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 15:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\15.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 16:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\16.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 17:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\17.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 18:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\18.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 19:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\19.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 20:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\20.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 21:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\21.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 22:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\22.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 23:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\23.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 24:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\24.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 25:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\25.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 26:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\26.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 27:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\27.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 28:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\28.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 29:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\29.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 30:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\30.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 31:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\31.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 32:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\32.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 33:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\33.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 34:
{string line;
ifstream myfile ("d:\\mcqs\\oop\\34.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
} system("CLS");if(ch=='a'||ch=='b'||ch=='c'||ch=='t'||ch=='f'||ch=='s')
goto y3;
else { cout<<"your test is restarted due to wrong entry please be careful next time"<<endl;goto y2;}
y3:;}}
};
class ITC:public Exam
{
public:
void getdeta()
{
system("CLS");
cout<<"*********************REGISTRATION FORM**************************"<<endl<<endl;
cout<<"Please enter your name :";
cin.getline(name,15);cout<<endl;
cout<<"Please enter your registration number:";
cin.getline(regno,15);cout<<endl;
cout<<"Please enter your institute name:";
cin.getline(institute,15);cout<<endl;
}
void display()
{
cout<<"Your name is :"<<name<<endl;
cout<<"Your registration number:"<<regno<<endl;
cout<<"Your institute name is:"<<institute<<endl;
}
void selection()
{
int a1;
cout<<"********************Selection of subject***********************"<<endl<<endl;
cout<<"Enter 1 for OOP, 2 for ITC, 3 for ITT"<<endl;
cin>>a1;
if(a1==1)
{cout<<"Your selected subject is OOP"<<endl;
s1=5;}
else if(a1==2)
{cout<<"Your selected subject is ITC"<<endl;
s1=6;}
else if(a1==3)
{cout<<"Your selected subject is ITT"<<endl;
s1=7;}
}
void resultcard()
{
display();
cout<<"Your acquired marks are"<<endl;
cout<<l<<endl;
ofstream outfile("d:\\result.txt");
outfile<<"Name: "<<name<<endl<<"Regstration Number: "<<regno<<endl<<"Institute: "<<institute<<endl<<"Marks:"<<l<<endl;
}
void infile()
{
string line;
system("CLS");
y6:
for(int i=1;i<=10;i++)
{
cout<<endl<<"*********************************************************** "<<endl;
cout<<"Question No."<<i<<":";
int arr1[34];
abc:
srand(time(0));
int j=1+rand()%33
;
for(int k=0;k<=i;k++)
{if (arr1[k]==j)
goto abc;}
arr1[i]=j;
switch(j)
{case 1:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\1.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 2:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\2.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 3:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\3.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 4:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\4.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 5:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\5.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 6:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\6.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 7:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\7.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 8:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\8.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 9:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\9.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 10:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\10.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 11:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\11.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 12:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\12.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 13:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\13.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 14:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\14.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 15:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\15.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 16:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\16.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 17:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\17.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 18:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\18.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 19:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\19.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 20:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\20.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 21:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\21.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 22:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\22.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 23:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\23.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 24:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\24.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 25:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\25.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 26:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\26.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 27:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\27.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 28:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\28.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 29:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\29.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 30:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\30.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 31:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\31.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 32:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\32.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 33:
{string line;
ifstream myfile ("d:\\mcqs\\itc\\33.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
}system("CLS");
if(ch=='a'||ch=='b'||ch=='c'||ch=='t'||ch=='f'||ch=='s')
goto y5;
else { cout<<"your test is restarted due to wrong entry please be careful next time"<<endl;goto y6;}
y5:;}}
};
class ITT:public Exam
{
private:
public:
void getdeta()
{
system("CLS");
cout<<"*********************REGISTRATION FORM**************************"<<endl<<endl;
cout<<"Please enter your name :";
cin.getline(name,15);cout<<endl;
cout<<"Please enter your registration number:";
cin.getline(regno,15);cout<<endl;
cout<<"Please enter your institute name:";
cin.getline(institute,15);cout<<endl;
}
void display()
{
cout<<"Your name is :"<<name<<endl;
cout<<"Your registration number:"<<regno<<endl;
cout<<"Your institute name is:"<<institute<<endl;
}
void selection()
{
int a1;
cout<<"********************Selection of subject***********************"<<endl<<endl;
cout<<"Enter 1 for OOP, 2 for ITC, 3 for ITT"<<endl;
cin>>a1;
if(a1==1)
{cout<<"Your selected subject is OOP"<<endl;
s1=5;}
else if(a1==2)
{cout<<"Your selected subject is ITC"<<endl;
s1=6;}
else if(a1==3)
{cout<<"Your selected subject is ITT"<<endl;
s1=7;}
}
void resultcard()
{
display();
cout<<"Your acquired marks are"<<endl;
cout<<l<<endl;
ofstream outfile("d:\\result.txt");
outfile<<"Name: "<<name<<endl<<"Regstration Number: "<<regno<<endl<<"Institute: "<<institute<<endl<<"Marks:"<<l<<endl;
}
void infile()
{
string line;
system("CLS");
y8:
for(int i=1;i<=10;i++)
{
cout<<endl<<"*********************************************************** "<<endl;
cout<<"Question No."<<i<<":";
int arr1[34];
abc:
srand(time(0));
int j=1+rand()%33
;
for(int k=0;k<=i;k++)
{if (arr1[k]==j)
goto abc;}
arr1[i]=j;
switch(j)
{case 1:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\1.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='b')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 2:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\2.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='b')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 3:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\3.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='b')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 4:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\4.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='b')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 5:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\5.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 6:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\6.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 7:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\7.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='b')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 8:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\8.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='a'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 9:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\9.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 10:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\10.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 11:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\11.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 12:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\12.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 13:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\13.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 14:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\14.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='c')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 15:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\15.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 16:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\16.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='c')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='b'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 17:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\17.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 18:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\18.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 19:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\19.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='b')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 20:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\20.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"your answer ? ";cin>>ch;
if(ch=='a')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='c'||ch=='a')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 21:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\21.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 22:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\22.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 23:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\23.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 24:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\24.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 25:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\25.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 26:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\26.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 27:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\27.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 28:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\28.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 29:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\29.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 30:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\30.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 31:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\31.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 32:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\32.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='t')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='f')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
case 33:
{string line;
ifstream myfile ("d:\\mcqs\\itt\\33.txt");
if (myfile.is_open())
{while (!myfile.eof())
{getline (myfile,line);
cout << line << endl;}
myfile.close();
cout<<"true ir false(t/f) ? ";cin>>ch;
if(ch=='f')
{
l=l+2;
cout<<"correct\nmarks= "<<l<<endl;}
else if (ch=='t')
{l=l-0.5;
cout<<"incorrect\nmarks= "<<l<<endl;}
}break;}
}system("CLS");if(ch=='a'||ch=='b'||ch=='c'||ch=='t'||ch=='f'||ch=='s')
goto y7;
else { cout<<"your test is restarted due to wrong entry please be careful next time"<<endl;goto y8;}
y7:;}}
};
int main()
{
char c1;
system("color 9a");
cout<<" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"<<endl;
cout<<" * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * * * * * "<<endl;
cout<<" * * * * * * * * * ****** * * * * * * * * * * * * * "<<endl;
cout<<" * * "<<endl;
cout<<" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * "<<endl;
cout<<" "<<endl;
cout<<"\n\n\n"<<endl;
cout<<"press c to continue..."<<endl;
cin>>c1;
system("CLS");
Exam e1;
OOP o1;
ITC i1;
ITT t1;
Exam *ptr1;
Exam *ptr2;
Exam *ptr3;
ptr1=&o1;
ptr2=&i1;
ptr3=&t1;
xy:
ptr1->getdeta();
ptr1->selection();
if(s1==5)
{
o1.infile();
}
else if(s1==6)
{
i1.infile();
}
else if(s1==7)
{
t1.infile();
}
ptr1->resultcard();
char ch5;
cout<<"To continue press y "<<endl;
cin>>ch5;
if(ch=='y'||'Y')
goto xy;
else
cout<<"Thanks for taking Exam"<<endl;
getche();
return 0;
}
NOW RUN THIS PROJECT.................
NOW RUN THIS PROJECT.................
No comments:
Post a Comment