Hi guys, I'm both new here, and new to c++ so be gentle!
Over the past short time we've been looking at c++ on our course, but I don't believe it has been taught too well, and I'm struggling to understand what should really be basic concepts? An assignment we've been issued with asks us to enter the details of 40 hills randomly in the form of a linked list (so the details would automatically be inserted randomly). Then further to that, the linked list trasnferred into an array then sorted. (displayed in the cout)
The problem I'm having is I don't know where to start - I've used and modified code from an earlier lab session, but I'm at my wits end trying to understand it and work out how to do what I want.
Here is the code from my header file to show the struct I've setup, but I've no idea how to take it to the level that's expected of me.
If anyone can help or provide any pointers I'd be very greatful - as I'm really hoping to do well in learning c++ beyond this assisgnemt.
#include <iostream>
using namespace std;
//define a node as a structure
struct Hills{ //a structure that can be
int hillsize;
int gridref;
int distanceFromHome;
bool climbed; //thought of as a simple class
Hills *link; //All fields are public
};
class LinkedList{ //now declare the class
private:
Hills *head; //pointer to the first node
Hills *last; //pointer to the last node
int count; //number of nodes
public:
LinkedList(); //constructor
void insertNodeAtStart(int newinfo); // inserts a node at start of list
void insertNodeAtEnd(int newinfo); // inserts a node at end of list
int getNodeCount(); //returns the number of nodes
Hills* getFirst(); //returns the pointer to the
//the first node - the value of "head"
void deleteFirstNode(); //deletes the first node in the list
bool findNumber(int number); //Q6 see if "number" is in the list
void deleteNode(int number); //Q7 delete a node with "number" as its data
}; //end of class declarations. REMEMBER THE SEMICOLON
Thanks in advance