-
Notifications
You must be signed in to change notification settings - Fork 0
/
CourseList.h
49 lines (37 loc) · 1.11 KB
/
CourseList.h
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
#pragma once
#ifndef COURSELIST_H
#define COURSELIST_H
class CourseList {
private:
// Structure for representing a course node
struct CourseNode {
int courseCode;
int creditHours;
char grade;
CourseNode* next;
// Constructor for initializing the course node
CourseNode(int cCode, int cHours, char cGrade) {
courseCode = cCode;
creditHours = cHours;
grade = cGrade;
next = nullptr;
}
};
CourseNode* head; // Pointer to the first node in the linked list
public:
// Constructor
CourseList();
// Destructor
~CourseList();
// Function to add a course to the list
void addCourse(int courseCode, int creditHours, char grade);
// Function to delete a course by course code
void deleteCourse(int courseCode);
// Function to delete all nodes in the list
void deleteAllNodes();
// Function to display the course list
void displayCourses() const;
//Function to check if List is empty
bool isEmpty();
};
#endif