cis22c/04-dl-lists/StudentList.h

45 lines
1005 B
C++

// Sorted Circular Doubly-Linked List with Sentinel Node
// Specification file for the Student List class
// Written by: Iurii Tatishchev
// Reviewed by: Iurii Tatishchev
// IDE: CLion
#ifndef STUDENTLIST_H
#define STUDENTLIST_H
struct Student {
double gpa;
std::string name;
};
class StudentList {
private:
// Declare a structure for the list
struct ListNode {
Student stu; // The value in this node
ListNode *forw; // To point to the next node
ListNode *back; // To point to the previous node
};
ListNode *head; // List head pointer
int count; // To keep track of the number of nodes in the list
public:
StudentList(); // Constructor
~StudentList(); // Destructor
// Linked list operations
int getCount() const { return count; }
bool insertNode(Student);
// bool deleteNode(double);
//void searchList() const;
void displayListForw() const;
void displayListBack() const;
};
#endif