cis22c/04-dl-lists/StudentList.h
2024-04-28 11:54:46 -07:00

46 lines
1020 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
#include <string>
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;}
void insertNode(Student);
//bool deleteNode(double);
//void searchList() const;
void displayListForw() const;
void displayListBack() const;
};
#endif