C++ programming
#ifndef STUDENTLIST_H
#define STUDENTLIST_H
#include <iostream>
#include <string>
#include "Node.h"
class studentList{
public:
studentList();
bool isEmpty();
Node* getHead();
void setHead(Node *n);
//Purpose: Print a list of the students in the list from head to tail
//Preconditions: Calling object is a list of students
//Postconditions: Output each student name in the list to the console, starting with the head and moving up to the tail.
void printStudentNamesFromHead(std::ostream& outstream= std::cout) const;
//Purpose: Print a list of the students in the list from head to tail
//Preconditions: output stream and the list of students
//Postconditions: Output each student name in the list to the output stream, starting with the head and moving up to the tail.
friend std::ostream& operator <<(std::ostream& outstream, const studentList& myStudents);
//Purpose: Add a new student to the head of the list.
//Preconditions: Calling object is a list of students, parameters are a string last name and first name.
//Postconditions: Add new student to the head of the list with the given name.
void addStudentHead(std::string newLname, std::string newFname);
//Purpose: Add a new student to the head of the list.
//Preconditions: input stream and the list of students
//Postconditions: Add new student to the head of the list with the given name.
// Take the first string from the input stream up to whitespace as the fname.
// Take the second string from the input stream up to whitespace as the lname.
friend std::istream& operator >>(std::istream& instream, studentList& myStudents);
//Purpose: Remove a student from the list.
//Preconditions: Calling object is a list of students, parameters are a string last name and first name.
//Postconditions: Remove a student from the list with the given name; first matching student starting from the head.
// Return true if removal was successful and false otherwise (when there is no student with the given first and last name).
bool removeStudent(std::string newLname, std::string newFname);
//Purpose: Delete all students in the list.
//Preconditions: Calling object is a list of students
//Postconditions: Safely deallocate memory for each node in the list.
~studentList();
//Purpose: Print a list of the students in the list from tail to head
//Preconditions: Calling object is a list of students
//Postconditions: Output each student name in the list to the console, starting with the tail and moving back to the tail.
void reverseList();
//Purpose: Print a list of the students in the list from tail to head
//Preconditions: Calling object is a list of students
//Postconditions: Output each student name in the list to the console, starting with the tail and moving back to the tail.
void insertionSort();
private:
Node *head;
};
#endif // STUDENTLIST_H