#include "NodeType.h" #include using namespace std; int main() { //create 3 pointers to nodes NodeType *head, *current, *temp; head = 0;//sets head to null temp = new NodeType;//create a new node temp->data = 45;//add the data temp->link = NULL;//make the link point to nothing (null) head = temp;//make head point at the new node for(int i=1;i<4;i++){//build forward current = new NodeType;//create new node current->data = 45*(i+1);//add the data current->link = temp->link;//attach to the list temp->link = current; temp = current;//move temp along with the list } /*for (int i=0; i<4; i++) {//build backward temp = new NodeType; temp->data = 45*(i+1); temp->link = head; head = temp; }*/ //print out the list current = head;//start at beginning while (current != NULL){ cout << current->data << " "; current = current->link;//move along } return 0; }