Hi all, I am trying to make a linked list of assignments, one that would keep track of homework. I was told to do it in the form of a doubly linked list, where each node would be able to point to previous and next, and contain data of the assignments due date, assigned date, title, and status (completed, late, currently assigned).
I have made a linked list with just a data pointer, where it would return a single number back to me and not have an issue. But I am unsure on how to get it to return 4 different entries back to me.
// dataNodeWithMultipleEntries.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Header1.h"
#include <string>
#include <iostream>
usingnamespace std;
Assigned::Assigned()
{
head = NULL;
curr = NULL;
temp = NULL;
}
void Assigned::displayAssignments()
{
curr = head;
while (curr != NULL)
{
cout << curr->dueDate << curr->assignedDate << endl;
curr = curr->next;
}
}
void Assigned::addAssignment(string name, int dueDate, int assignedDate)
{
}
int main()
{
return 0;
}
My problem is that I can make a node with just next/prev pointers and a data field, but when it comes to having 4 different kinds I get a little lost. Also I know my addAssignment is lacking my enum status, I am still trying to figure out how those work too. Any help is appreciated, thanks!
I don't understand what makes it harder having four data values instead of one. If you prefer you could create another struct that contains the four values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
struct node_data
{
string title;
enum status { late, assigned, completed };
int dueDate;
int assignedDate;
};
struct node
{
node* next;
node* prev;
node_data data;
};