OOP-Project 01
OOP-Project 01
//
// You are tasked with developing a Student Information System using C++ that
manages student records.
// The system should be menu-driven, allowing users to interact with it through a
series of options.
// You will implement this system using 2D arrays to store student data.
// The following functionalities must be included in the program MENU:
//
// 1. Enter the Number of Students : The user should be able to input the number of
student records to be managed by the system.
//
// 2. Insert Student Record : The user can enter details such as Student ID, Name, and
Marks for each student.
// These records should be stored in a 2D array.
//
// 3. Update Student Record : The user should be able to update the information of a
student by searching for the Student ID and modifying their record.
//
// 4. Search Student Record : The system should allow the user to search for a student
by Student ID Or by Student Name and display the corresponding record.
//
// 5. Delete Student Record : The system should enable the user to delete a specific
student's record using the Student ID.
// After deletion, the space should be freed up for a new student record.
//
// 6. Display All Records : The system should display all student records stored in the
2D array in a tabular format.
//
// Requirements :
// - The program must be fully menu-driven.
// - Use a 2D array to store student information (Student ID, Name, and Marks).
// - Implement input validation where necessary (e.g., ensuring valid Student IDs).
// - The program should be able to handle at least 10 students.
// - Properly manage array indices to prevent out-of-bounds errors.
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// Function to set the number of students and initialize the 2D array with required
attributes
void No_OF_Students_Func(int attributes) {
cout << "Enter the number of students( at least 10 ): ";
cin >> No_Of_Students;
/*if (No_Of_Students < 10) {
cout << "Setting min Students to 10.\n";
No_Of_Students = 10;
}*/
students = new string * [No_Of_Students]; // Allocate memory for rows (students)
for (int i = 0; i < No_Of_Students; i++) {
students[i] = new string[attributes]; // Allocate memory for columns
(attributes per student)
}
}
// Function to input student records including Name, ID, and Marks with validation
checks
void Input_Student_Rec() {
int attributes = 3; // Number of attributes per student (Name, ID,
Marks)
int student_Count;
// Function to search for a student record by Name or ID and display the results
void Search_Student_Record() {
int nameRep = 0; // Counter for repeated names
string searchRec;
// Main function that displays the menu and performs actions based on user input
int main() {
int choice;
int attributes = 3; // Number of attributes (Name, ID, Marks)
cout << string(50, ' ') << "STUDENT INFORMATION SYSTEM\n" << string(266, '*') <<
endl;
while (true) {
DisplayMenu();
cout << "\nEnter choice: ";
cin >> choice;
switch (choice) {
case 1:
No_OF_Students_Func(attributes);
break;
case 2:
Input_Student_Rec();
break;
case 3:
Update_Student_Rec();
break;
case 4:
Search_Student_Record();
break;
case 5:
Delete_Student_Record();
break;
case 6:
Display_All_Records();
break;
case 7:
Exit_Program();
exit(0);
default:
cout << "Invalid choice.\n";
}
}
return 0;
}