0% found this document useful (0 votes)
5 views

Lab 1 Submission File

The document outlines an implementation of an Exam Management System using C++. It includes classes for managing users, tests, marks, teachers, and students, along with methods for adding, updating, and retrieving information. The system features an admin login for secure access to various functionalities related to student and teacher management.

Uploaded by

Shuvom Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Lab 1 Submission File

The document outlines an implementation of an Exam Management System using C++. It includes classes for managing users, tests, marks, teachers, and students, along with methods for adding, updating, and retrieving information. The system features an admin login for secure access to various functionalities related to student and teacher management.

Uploaded by

Shuvom Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

NATIONAL INSTITUTE OF TECHNOLOGY,SILCHAR

Name: Apurv Anand


Scholar Id: 2112052
Branch: CSE (Sec-A)
Subject: Object Oriented Design Laboratory
Topic: Assignment-1
Title: Implementation of Exam Management
System
CLASS DIAGRAM:

CODE:

#include <bits/stdc++.h>

using namespace std;

class admin

public:

string pass;

vector<string> UserName;

vector<int> Password;

void makeUserName()

for (int i = 0; i <= 100; i++)

UserName.push_back("/");

void makePassword()

for (int i = 0; i <= 100; i++)


{

Password.push_back(0);

void SetUserName()

cout << "Enter your ID:" << endl;

int id;

cin >> id;

cout << "Enter User Name:" << endl;

string s;

cin >> s;

UserName[id] = s;

void SetPassword()

cout << "Enter your ID:" << endl;

int id;

cin >> id;

cout << "Enter Password:" << endl;

int s;

cin >> s;

Password[id] = s;

bool CheckUserNamePassword()

cout << "Enter your ID:" << endl;

int id;

cin >> id;

cout << "Enter your username:" << endl;

string u;

cin >> u;

cout << "Enter your password:" << endl;

int p;

cin >> p;

if (UserName[id] == u && Password[id] == p)

return true;

else

return false;

void EnterPassword()

cin >> this->pass;

bool CheckPassword()

cout << "ONLY ADMIN PERMITTED::Enter the password:" << endl;


string n;

cin >> n;

if (n == pass)

return true;

else

return false;

};

class Test

public:

int id[100];

string name[100], date[100], subject[100], subjectId[100];

int numberOfStudents[100];

void addTest()

int tid;

cout << "Enter Test id:" << endl;

cin >> tid;

cout << "Enter name:" << endl;

string tname1;

cin >> tname1;

name[tid] = tname1;

cout << "Enter date:" << endl;

string tname2;

cin >> tname2;

date[tid] = tname2;

cout << "Enter subject:" << endl;

string tname3;

cin >> tname3;

subject[tid] = tname3;

cout << "Enter subjectID:" << endl;

string tname4;

cin >> tname4;

subjectId[tid] = tname4;

cout << "Enter numberOfStudents:" << endl;

int tnum;

cin >> tnum;

numberOfStudents[tid] = tnum;

int marks[100][100];

void addMarks()

int id;

cout << "Enter Test id:" << endl;

cin >> id;

int n = numberOfStudents[id];
cout << "Number of students enrolled is " << n << endl;

cout << "Enter marks of the students:" << endl;

for (int i = 0; i < n; i++)

cin >> marks[id][i];

void getMarks()

int id;

cout << "Enter Subject id:" << endl;

cin >> id;

int n = numberOfStudents[id];

for (int i = 0; i < n; i++)

cout << (i + 1) << " " << marks[id][i] << endl;

void getMarksStudentWise()

cout << "Enter Subject ID:" << endl;

int sid;

cin >> sid;

cout << "Enter you scholar id:" << endl;

int scholarid;

cin >> scholarid;

scholarid--;

cout << "Marks obtained is " << marks[sid][scholarid] << endl;

void AllStudentsMarks()

cout << "Enter Subject ID:" << endl;

int sid;

cin >> sid;

int n = numberOfStudents[sid];

cout << "Marks Obtained by enrolled students are: " << endl;

cout << "Scholar Id\t"

<< " Marks" << endl;

for (int i = 0; i < n; i++)

cout << (i + 1) << "\t\t\t" << marks[sid][i] << endl;

void StudentsStatistics()

int passed = 0, failed = 0;

vector<int> passedId, failedId;

vector<pair<int, int>> sorted;

cout << "Enter Subject ID:" << endl;

int sid;

cin >> sid;


int n = numberOfStudents[sid];

int sum = 0;

for (int i = 0; i < n; i++)

sum += marks[sid][i];

if (marks[sid][i] > 30)

passed++;

passedId.push_back(i);

sorted.push_back({marks[sid][i], i});

else

failed++;

failedId.push_back(i);

sort(sorted.begin(), sorted.end(), greater<pair<int, int>>());

int average = sum / n;

int exit = 1;

while (exit)

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Get number of passed students (Marks greater than or equal to 30)" << endl

<< "2.Get number of failed students (Marks lesser than 30)" << endl

<< "3.Get Scholar of passed students" << endl

<< "4.Get Scholar of failed students" << endl

<< "5.Get average marks" << endl

<< "6.Sorted Marks" << endl

<< "7.Exit " << endl;

cout << "---------------------------------------------------" << endl;

int ch;

cin >> ch;

switch (ch)

case 1:

cout << "Number of students having marks greater than or equal to 30 are " << passed << endl;

break;

case 2:

cout << "Number of students having marks lesser than 30 are " << failed << endl;

break;

case 3:

cout << "Scholar Id of passed students are:" << endl;

for (int i = 0; i < passedId.size(); i++)

cout << passedId[i] + 1 << " ";

cout << endl;

break;
case 4:

cout << "Scholar Id of failed students are:" << endl;

for (int i = 0; i < failedId.size(); i++)

cout << failedId[i] + 1 << " ";

cout << endl;

break;

case 5:

cout << "Average marks obtained in this paper is " << average << endl;

break;

case 6:

int quant;

cout << "How many toppers you want?" << endl;

cin >> quant;

cout << "Scholar Id"

<< " "

<< "Marks" << endl;

for (int i = 0; i < quant; i++)

cout << sorted[i].second + 1 << " \t\t" << sorted[i].first << endl;

break;

case 7:

exit = 0;

break;

};

class Result : public Test

public:

void getMarksStudentWise()

cout << "Enter Subject ID:" << endl;

int sid;

cin >> sid;

cout << "Enter you scholar id:" << endl;

int scholarid;

cin >> scholarid;

cout << "Marks obtained is " << marks[sid][scholarid] << endl;

void AllStudentsMarks()

cout << "Enter Subject ID:" << endl;

int sid;

cin >> sid;

int n = numberOfStudents[sid];

for (int i = 0; i < n; i++)

{
cout << (i + 1) << "\t" << marks[sid][i] << endl;

};

class ExamDepartment : public Result

public:

// find students

// find checkers

};

class Teacher

public:

int id[100];

string name[100];

string branch[100];

string designation[100], education[100], email[100];

int salary[100];

void addTeacher()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter name:" << endl;

string tname;

cin >> tname;

name[tid] = tname;

cout << "Enter branch:" << endl;

string tbranch;

cin >> tbranch;

branch[tid] = tbranch;

cout << "Enter designation:" << endl;

string tdesignation;

cin >> tdesignation;

designation[tid] = tdesignation;

cout << "Enter education:" << endl;

string teducation;

cin >> teducation;

education[tid] = tname;

cout << "Enter email:" << endl;

string temail;

cin >> temail;

email[tid] = tname;

void aboutTeacher()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Name is " << name[tid] << endl;

cout << "Branch is " << branch[tid] << endl;


cout << "Designation is " << designation[tid] << endl;

void changeName()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new name:" << endl;

string tname;

cin >> tname;

name[tid] = tname;

void changeBranch()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new branch:" << endl;

string tbranch;

cin >> tbranch;

branch[tid] = tbranch;

void changeDesignation()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new designation:" << endl;

string tname;

cin >> tname;

designation[tid] = tname;

void changeEducation()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new education:" << endl;

string tname;

cin >> tname;

education[tid] = tname;

void changeEmail()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new email:" << endl;

string tname;

cin >> tname;

email[tid] = tname;
}

};

class student : public Test

public:

int id[100];

string name[100];

string branch[100];

string program[100];

void addStudent()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter name:" << endl;

string tname;

cin >> tname;

name[tid] = tname;

cout << "Enter branch:" << endl;

string tbranch;

cin >> tbranch;

branch[tid] = tbranch;

cout << "Enter program:" << endl;

string tprogram;

cin >> tprogram;

program[tid] = tprogram;

void aboutStudent()

int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Name is " << name[tid] << endl;

cout << "Branch is " << branch[tid] << endl;

cout << "Program enrolled is " << program[tid] << endl;

void changeName()

{ int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new name:" << endl;

string tname;

cin >> tname;

name[tid] = tname; }

void changeBranch()

{ int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new branch:" << endl;

string tbranch;

cin >> tbranch;


branch[tid] = tbranch; }

void changeProgram()

{ int tid;

cout << "Enter id:" << endl;

cin >> tid;

cout << "Enter new program:" << endl;

string tname;

cin >> tname;

program[tid] = tname;}};

int main()

{student S;

// S.addStudent();

// S.addStudent();

// S.addStudent();

// S.aboutStudent();

Teacher T;

// M.addMarks();

Result R;

Test T1;

admin A;

// R.getMarks();

int exit = 1;

cout << "---------------------------------------------------" << endl;

cout << "ADMIN:: Set Password:" << endl;

A.EnterPassword();

cout << "---------------------------------------------------" << endl;

cout << "First Register yourself:" << endl;

A.makeUserName();

A.makePassword();

A.SetUserName();

A.SetPassword();

cout << "---------------------------------------------------" << endl;

cout << "Login Window" << endl;

int f = A.CheckUserNamePassword();

cout << "---------------------------------------------------" << endl;

while (exit & f)

{cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Equiry about student" << endl

<< "2.Equiry about Teacher" << endl

<< "3.Equiry about Marks" << endl

<< "4.Equiry about Result" << endl

<< "5.Exit " << endl;

cout << "---------------------------------------------------" << endl;

int ch;

cin >> ch;

switch (ch)

case 1:

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;


cout << "1.Add Student" << endl

<< "2.About Student" << endl

<< "3.Change Name" << endl

<< "4.Change Branch" << endl

<< "5.Change Program" << endl

<< "6.Exit " << endl;

cout << "---------------------------------------------------" << endl;

int p;

cin >> p;

switch (p)

case 1:

if (A.CheckPassword())

S.addStudent();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 2:

S.aboutStudent();

break;

case 3:

if (A.CheckPassword())

S.changeName();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 4:

if (A.CheckPassword())

S.changeBranch();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 5:

if (A.CheckPassword())

S.changeProgram();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 6:

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Equiry about student" << endl

<< "2.Equiry about Teacher" << endl


<< "3.Equiry about Marks" << endl

<< "4.Equiry about Result" << endl

<< "5.Exit " << endl;

cout << "---------------------------------------------------" << endl;

cin >> ch;

break;

break;

case 2:

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Add Teacher" << endl

<< "2.About Teacher" << endl

<< "3.Change Name" << endl

<< "4.Change Branch" << endl

<< "5.Exit " << endl;

cout << "---------------------------------------------------" << endl;

// int p;

cin >> p;

switch (p)

case 1:

if (A.CheckPassword())

T.addTeacher();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 2:

T.aboutTeacher();

break;

case 3:

if (A.CheckPassword())

T.changeName();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 4:

if (A.CheckPassword())

T.changeBranch();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 5:

cout << "---------------------------------------------------" << endl;


cout << "Choose one of the following options:" << endl;

cout << "1.Equiry about student" << endl

<< "2.Equiry about Teacher" << endl

<< "3.Equiry about Marks" << endl

<< "4.Equiry about Result" << endl

<< "5.Exit " << endl;

cout << "---------------------------------------------------" << endl;

cin >> ch;

break;

break;

case 3:

if (A.CheckPassword())

T1.addTest();

T1.addMarks();

else

cout << "ACCESS DENIED :: ONLY ADMIN PERMITTED." << endl;

break;

case 4:

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Get Marks of a particular Roll number:" << endl

<< "2.Get all enrolled marks:" << endl

<< "3.Get Marks Statistics:" << endl

<< "4.Exit " << endl;

cout << "---------------------------------------------------" << endl;

int choice;

cin >> choice;

switch (choice)

case 1:

T1.getMarksStudentWise();

break;

case 2:

T1.AllStudentsMarks();

break;

case 3:

T1.StudentsStatistics();

case 4:

cout << "---------------------------------------------------" << endl;

cout << "Choose one of the following options:" << endl;

cout << "1.Equiry about student" << endl

<< "2.Equiry about Teacher" << endl

<< "3.Equiry about Marks" << endl

<< "4.Equiry about Result" << endl

<< "5.Exit " << endl;


cout << "---------------------------------------------------" << endl;

cin >> ch;

break;

case 5:

exit = 0;

break;

if (f == 0)

cout << "Login Failed! Enter correct Username and password." << endl;

OUTPUTS:

You might also like