Created
May 5, 2019 00:00
-
-
Save harshityadav95/f584efdb1ed12c031756aecad8b30200 to your computer and use it in GitHub Desktop.
Student Management System
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tuapin System Student Management System | |
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
const int m = 50; | |
class student | |
{ | |
private: | |
int student_id; | |
string student_name; | |
int student_subjects_id[m]; | |
string student_grades[m]; | |
public: | |
int count = 0; | |
int subject_count = 0; | |
//int course_count = 0; | |
student(void); | |
~student() | |
{ | |
cout << "\n Destructed Class Student"; | |
} | |
void student_getdata(); | |
void student_putdata(); | |
void student_add_subjects(); | |
void student_add_grades(); | |
int student_id_return(); | |
void student_transcript(); | |
}; | |
// Constructor for the Students Class | |
student::student(void) | |
{ | |
//cout << "\n Student Data initialised" << endl; | |
} | |
int student::student_id_return() | |
{ | |
return student_id; | |
} | |
void student::student_transcript() | |
{ | |
cout << "\n______________\n"; | |
cout << "\nStudent ID :" << student_id; | |
cout << "\nSudent Name:" << student_name; | |
for (int i = 0; i < subject_count; i++) | |
{ | |
cout << "\nSubject :" << student_subjects_id[i] << " Grade :" << student_grades[i]; | |
} | |
cout << "\n______________\n"; | |
} | |
void student::student_getdata() | |
{ | |
int id; | |
string name; | |
cout << "\nEnter the Student ID :"; | |
cin >> id; | |
cout << "Enter the Student Name :"; | |
cin >> name; | |
student_id = id; | |
student_name = name; | |
cout << "Student Saved Successfully !\n\n"; | |
} | |
void student::student_putdata() | |
{ | |
cout << "\nStudent ID :" << student_id; | |
cout << "\nStudent Name :" << student_name; | |
cout << "\n----------------------------\n"; | |
} | |
void student::student_add_subjects() | |
{ | |
int loop = 1; | |
while (loop) | |
{ | |
int code; | |
cout << "Enter the Subject ID Enrolled By Student :"; | |
cin >> code; | |
student_subjects_id[subject_count] = code; | |
cout << "Subject Saved Successfully !\n\n"; | |
subject_count++; | |
cout << "want to enter more Subjects : 1-Yes 2-No :"; | |
int option = 0; | |
cin >> option; | |
if (option == 2) | |
loop = 0; | |
} | |
} | |
void student::student_add_grades() | |
{ | |
for (int i = 0; i < subject_count; i++) | |
{ | |
string grade; | |
cout << "\n For Subject Code" << student_subjects_id[i] << " Grade is :"; | |
cin >> student_grades[i]; | |
} | |
} | |
class course | |
{ | |
private: | |
int course_id[m]; | |
string course_name[m]; | |
public: | |
int count = 0; | |
course(); | |
~course() | |
{ | |
cout << "\n Destructed Class Course"; | |
} | |
void course_get_data(); | |
void course_putdata(); | |
}; | |
// Constructor for the Course Class | |
course::course() | |
{ | |
cout << "\n Course Data Initialised" << endl; | |
} | |
void course::course_get_data(void) | |
{ | |
int id; | |
string name; | |
cout << "\nEnter the Course ID :"; | |
cin >> id; | |
cout << "Enter the Course Name :"; | |
cin >> name; | |
course_id[count] = id; | |
course_name[count] = name; | |
cout << "Course Saved Successfully !\n\n"; | |
count++; | |
} | |
void course::course_putdata() | |
{ | |
for (int i = 0; i < count; i++) | |
{ | |
cout << "\nCourse ID " << i << " :" << course_id[i]; | |
cout << "\nCourse Name " << i << " :" << course_name[i]; | |
cout << "\n----------------------------\n"; | |
} | |
if (count == 0) | |
{ | |
cout << "\n No Record Found"; | |
} | |
} | |
class subjects | |
{ | |
private: | |
int subject_code[m]; | |
string subject_name[m]; | |
//string subject_grade; | |
public: | |
int count = 0; | |
subjects(void); | |
~subjects() | |
{ | |
cout << "\n Destructed Class Subjects"; | |
} | |
void subjects_getdata(); | |
void subject_putdata(); | |
}; | |
// Constructor for the Subjects class | |
subjects::subjects() | |
{ | |
cout << "\n Subjects Data Initialised" << endl; | |
} | |
void subjects::subjects_getdata() | |
{ | |
int code; | |
string name; | |
cout << "\nEnter the Subject ID :"; | |
cin >> code; | |
cout << "Enter the Subject Name :"; | |
cin >> name; | |
subject_code[count] = code; | |
subject_name[count] = name; | |
cout << "Subject Saved Successfully !\n\n"; | |
count++; | |
} | |
void subjects::subject_putdata() | |
{ | |
for (int i = 0; i < count; i++) | |
{ | |
cout << "\nSubject ID " << i << " :" << subject_code[i]; | |
cout << "\nSubject Name " << i << " :" << subject_name[i]; | |
cout << "\n----------------------------\n"; | |
} | |
if (count == 0) | |
{ | |
cout << "\n No Record Found"; | |
} | |
} | |
int main() | |
{ | |
student A[m]; | |
int student_count = 0; | |
course B; | |
subjects C; | |
int option = 0; | |
while (1) | |
{ | |
cout << "\n----------Main Menu Option----------"; | |
cout << "\n1.Courses"; | |
cout << "\n2.Subjects"; | |
cout << "\n3.Students"; | |
cout << "\n0.Exit" << endl; | |
cout << "Your Input :"; | |
cin >> option; | |
switch (option) | |
{ | |
case 1: | |
{ | |
int loop = 1; | |
while (loop) | |
{ | |
cout << "\n----------Course Menu Option----------"; | |
cout << "\n1.View All Courses"; | |
cout << "\n2.Enter a New Course"; | |
cout << "\n3. for Back/Exit" << endl; | |
cout << "Your Input :"; | |
int suboption = 0; | |
cin >> suboption; | |
switch (suboption) | |
{ | |
case 1: | |
B.course_putdata(); | |
break; | |
case 2: | |
B.course_get_data(); | |
break; | |
case 3: | |
loop = 0; | |
break; | |
} | |
} | |
} | |
break; | |
case 2: | |
{ | |
int loop = 1; | |
while (loop) | |
{ | |
cout << "\n----------Subject Menu Option----------"; | |
cout << "\n1.View All Subjects"; | |
cout << "\n2.Enter a New Subject"; | |
cout << "\n3. for Back/Exit" << endl; | |
cout << "Your Input :"; | |
int suboption = 0; | |
cin >> suboption; | |
switch (suboption) | |
{ | |
case 1: | |
C.subject_putdata(); | |
break; | |
case 2: | |
C.subjects_getdata(); | |
break; | |
case 3: | |
loop = 0; | |
break; | |
} | |
} | |
} | |
break; | |
case 3: | |
{ | |
int loop = 1; | |
while (loop) | |
{ | |
cout << "\n---------- Student Option Menu----------"; | |
cout << "\n1.View All Students"; | |
cout << "\n2.Enroll a New Student"; | |
cout << "\n3.Update Marks of Existing Student"; | |
cout << "\n4.Print Transcript of Selcted Student"; | |
cout << "\n5. for Back/Exit" << endl; | |
cout << "Your Input :"; | |
int suboption = 0; | |
cin >> suboption; | |
switch (suboption) | |
{ | |
case 1: | |
{ | |
for (int i = 0; i < student_count; i++) | |
{ | |
A[student_count].student_putdata(); | |
} | |
} | |
break; | |
case 2: | |
{ | |
student_count++; | |
for (int i = 0; i < student_count; i++) | |
{ | |
A[i].student_getdata(); | |
A[i].student_add_subjects(); | |
} | |
} | |
break; | |
case 3: | |
{ | |
cout << "Enter the Student ID to Enter the Grades "; | |
int id; | |
cin >> id; | |
int flag = 0; | |
for (int i = 0; i < student_count; i++) | |
{ | |
if (A[i].student_id_return() == id) | |
{ | |
A[i].student_add_grades(); | |
flag = 1; | |
} | |
} | |
if (flag = 0) | |
{ | |
cout << "\n No Student with that record found"; | |
} | |
} | |
break; | |
case 4: | |
{ | |
cout << "Enter the Student ID to Transcript "; | |
int id; | |
cin >> id; | |
int flag = 0; | |
for (int i = 0; i < student_count; i++) | |
{ | |
if (A[i].student_id_return() == id) | |
{ | |
A[i].student_transcript(); | |
flag = 1; | |
} | |
} | |
if (flag = 0) | |
{ | |
cout << "\n No Student with that record found"; | |
} | |
} | |
break; | |
case 5: | |
{ | |
loop = 0; | |
} | |
break; | |
} | |
} | |
} | |
break; | |
case 0: | |
exit(1); | |
break; | |
default: | |
cout << "Try Again Proper Input from Menu\n"; | |
break; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment