-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchoolManagement.cpp
50 lines (41 loc) · 1.15 KB
/
SchoolManagement.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <string>
using namespace std;
// Class for managing student records
class Student {
private:
string name;
int rollNo;
string grade;
public:
// Default Constructor
Student() {
name = "Unknown";
rollNo = 0;
grade = "Not assigned";
}
// Destructor
~Student() {
cout << "Record of student " << name << " is deleted." << endl;
}
// Function to enroll a student
void enrollStudent(string sName, int sRollNo, string sGrade) {
name = sName;
rollNo = sRollNo;
grade = sGrade;
}
// Function to display student details
void displayStudentInfo() {
cout << "Student Name: " << name << endl;
cout << "Roll No: " << rollNo << endl;
cout << "Grade: " << grade << endl;
}
};
int main() {
Student s1;
// Enrolling a student
s1.enrollStudent("Alice Johnson", 12, "A");
// Display student information
s1.displayStudentInfo();
return 0;
}