hey guys. any help would be greatly appreciated. im getting a few errors and im not sure why.

HEADER FILE:

// HEADER FILE floatlist
//
// INCLUSE STANDARD I/O HEADER
#include <iostream>
using namespace std;

template <class T>
class floatlist
{
	// DECLARE PRIVATE DATA
	private:
	//
	// DECLARE A CLASS FOR THE LISTNODE
	class listnode
	{
       // DECLARE floatlist AS FRIEND. ALLOW ALL MEMBER FUNCTIONS OF
		// floatlist ACCESS THE MEMBERS OF listnode
		friend class floatlist;
		//
		// DECLARE FLOATING POINT VARIABLE value
		// THIS IS THE NUMBER TO BE STORED IN LINKED LIST
	   T value;
	   //
	   // DECLARE POINTER POINTING TO THE NEXT NODE
	   // ADD STATEMENT 4 BELOW
	   listnode *next;
	   //
	   // DEFINE CONSTRUCTOR TO INITIALIZE VALUES FOR CLASS listnode
	   // ADD STATEMENT 5 BELOW
       listnode(T value1, listnode *next1 = NULL)
         {
            value = value1;
            next = next1;
         }
	};
	//
	// DECLARE listnode HEAD POINTER
	// ADD STATEMENT 6 BELOW
    listnode *head;
	//

	public:
		// CONSTRUCTOR FOR CLASS floatlist
		floatlist() {	
			head = NULL;
        } 
		
		// DECLARE FUNCTION PROTOTYPE appendnode
		// IT IS A VOID FUNCTION
		// IT RECEIVES THE NUMBER TO BE ADDED TO THE LIST
		void appendnode(T);
		//
		// DECLARE FUNCTION PROTOTYPE deletenode
		// IT IS A VOID FUNCTION
		// IT RECEIVES THE NUMBER TO BE DELETED FROM THE LIST
		void insertnode(T);
        void deletenode(T);
		//
		// DECLARE FUNCTION PROTOTYPE displaylist
		// IT IS A VOID FUNCTION
		// IT DOES NOT RECEIVE DATA
		void displaylist();
};
//
// DEFINE FUNCTION appendnode
// IT IS A MEMBER OF THE CLASS floatlist
// RECEIVES THE NUMBER TO BE ADDED TO THE LIST
template<class T>
void floatlist<T>::appendnode(T val)
{
	// IF HEAD IS EMPTY ADD THE NUMBER TO THE NODE
	// ADD STATEMENTS 7 BELOW
    if(head==NULL)
      head = new listnode(val);
	//
	// HEAD NOT EMPTY
	else
	{
		// HEAD NOT EMPTY = CREATE A SECOND POINTER
		// ADD STATEMENT 8 BELOW
	    listnode *nodeptr;
		//
		// ASSIGN HEAD VALUE TO SECOND POINTER
		// ADD STATEMENT 9 BELOW
		nodeptr = head;
		//
		// GO THROUGH LIST UNTIL A NULL POINTER IS FOUND
		// THIS IS THE LAST NODE
		// ADD STATEMENTS 10 BELOW 
	    while(nodeptr ->next!= NULL)
	         nodeptr = nodeptr->next;
		//
		// NULL POINTER FOUND, ADD NEW NODE
		// ADD STATEMENT 11 BELOW
		nodeptr->next = new listnode(val);
	}
}
//

// DEFINE FUNCTION displaylist
// IT IS A MEMBER OF THE CLASS floatlist
template<class T>
void floatlist<T>::displaylist()
{
	// CREATE A SECOND POINTER
	listnode *nodeptr;
	//
	// // ASSIGN HEAD VALUE TO SECOND POINTER
	nodeptr=head;
	//
	// IF THE LIST IS EMPTY, DO NOTHING.
	// ADD STATEMENTS 13
    if(!head)
      cout << "NO DATA IN THE LINKED LIST.";
    //
    //
	// OUTPUT DATA AS LONG AS NODE IS NOT NULL
	// ADD STATEMENTS 14
	while(nodeptr)
    {
        cout << nodeptr->value << endl;
        nodeptr = nodeptr->next;
    }
}


template<class T>
void floatlist<T>::insertnode(T val)
{
     listnode *nodeptr, *previousnodeptr;
     
     if (head == NULL || head->value >=val)
{
     head = new listnode(val, head);
}
else
{
    previousnodeptr = head;
    nodeptr = head-> next;
    
    while (nodeptr != NULL && nodeptr->value < val)
    {
          previousnodeptr = nodeptr;
          nodeptr = nodeptr->next;
}
previousnodeptr->next = new listnode(val, nodeptr);
}
}


// DEFINE FUNCTION deletenode
// IT IS A MEMBER OF THE CLASS floatlist
// RECEIVES THE NUMBER TO BE DELETED FROM THE LIST
template<class T>
void floatlist<T>::deletenode(T val)
{
	// DECLARE TWO NODE POINTERS
	// ADD STATEMENT 16 BELOW
    listnode *nodeptr, *previousnodeptr;
	//
	// IF THE LIST IS EMPTY, DO NOTHING.
	if(!head)
	{
             cout << "NO DATA IN THE LINKED LIST.\n";
		return;
    }
	//
	// DETERMINE IF THE FIRST NODE IS THE ONE TO DELETE.
	// ADD STATEMENTS 17 BELOW
    if(head ->value == val)
    {
         nodeptr = head;       //ASSIGN HEAD TO POINTER
         head = head ->next;   //ASSIGN HEAD AS NEXT NODE
         delete nodeptr;       //DELETE THE POINTER
    }
	//
	// FIRST NODE IS NOT THE ONE TO BE DELETED
	else
	{
		//INITIALIZE nodeptr TO HEAD OF LIST
		nodeptr = head;
		//
		// SKIP ALL NODES WHOSE VALUE MEMBER IS NOT EQUAL TO num
		// ADD STATEMENTS 18 BELOW
        while(nodeptr != NULL && nodeptr ->value != val)
        {
             previousnodeptr = nodeptr;   //ASSIGN CURRENT NODE TO PREVIOUS NODE
             nodeptr = nodeptr ->next;    //ADVANCE TO NEXT NODE
        }
		// FOUND THE NUMBER TO BE DELETED.  LINK THE PREVIOUS NOVE
		// TO THE NODE AFTER nodeptr, THEN DELETE nodeptr
		// ADD STATEMENTS 19 BELOW
	    if (nodeptr)
  	    {
                    previousnodeptr -> next = nodeptr -> next; //the previous node pointer is the address of the next poniner
                    delete nodeptr;          //delete the node pointer, not the value held in node
         }
	}
}

MAIN FILE:

#include <iostream>

using namespace std;
//
// LINK TO CLASS FILE floatlist
// ADD STATEMENT 1 BELOW
#include "floatlist.h"
//
// DECLARE USERCOMMENTS FUNCTION
// THE FUNCTION DOES NOT RECEIVE OR RETURN DATA
void usercomments(void);
//
// START MAIN
int main()
{
	//
	// CALL FUNCTION usercomments
	usercomments();

floatlist list;

	int operations;  // WHAT OPERATION TO BE DONE (Start or Stop)
	int choice;  // ADD DATA, DELETE DATA, DISPLAY DATA, EXIT
	float value; // NUMBER TO BE ADDED TO THE LINKED LIST

	//
	do
	{
		cout<< "\nChoose an option below: \n";
    	cout<< "\t1) Add data.\n";
	    cout<< "\t2) Display data. \n";
	    cout<< "\t3) Delete data.\n";
     	cout<< "\t4) Exit. \n\n";
       cout << "Enter your choice ( 1, 2, 3, or 4): ";
	   cin>>choice;
	//
	if (choice >=1 && choice <=4)
	{
	// WHICH CHOICE DID USER SPECIFY?
	         switch(choice)
	         {
	          // ADD DATA
	          case 1: 
			cout << "\nEnter a numerical value (-1 to Stop): " << endl;
			cin>>value;
			while (value != -1)
			{
            //
            // ACCESS THE appendnode FUNCTION INSIDE THE CLASS floatlist
            // ADD STATEMENT 3 BELOW
		    list.appendnode();
			cout << "Enter a numberical value (-1 to Stop): "<<endl;
			cin>>value;
			}
			break;
	//

		// DISPLAY DATA
	case 2:
			cout<<"\nNumbers in the linked list are as follows: \n";
            // ACCESS THE displaylist FUNCTION INSIDE THE CLASS floatlist
            // ADD STATEMENT 12 BELOW
            list.displaylist();
			cout<<"\n";
			break;
	// 
	//
	// DELETE DATA
	case 3:
			cout<< "\nEnter a number in the list to delete: "<<endl;
			cin>>value;
            // ACCESS THE deletenode FUNCTION INSIDE THE CLASS floatlist
            // ADD STATEMENT 15 BELOW
            list.deletenode(value);
			break;
	//


	// EXIT
	case 4:
		cout<<"\n\n\nProgram terminated successfully!\n\n\n";
		system("pause");
		break;
        } // end case
    }
	
	else if (choice != 4)
	    {
              cout << "\nThe valid choices are 1 through 4.\n"; 
              cout << "\nSelect one of the valid choices.\n";
              }
        
   } while (choice != 4); // loop for more data
   //
	
	//
	// DISPLAY TERMINATION MESSAGE
	cout<<"\n\n\nProgram terminated successfully!\n\n\n";

}	// END MAIN
//
//		
// DEFINE FUNCTION usercomments
void usercomments(void)
{
	cout<<"This program uses a linked list.  The user has the options to"
		<<"\nadd data to the list, delete data from the list, or display"
		<<"\nthe contents of the list.\n\n";
}

These are the errors in getting:

In function `int main()':
line 28, missing template arguments before "list"
line 28, expected `;' before "list"
line 59, `list' undeclared (first use this function)

C:\Users\Desktop\open ch.17.dev file\Makefile.win [Build Error] [main.o] Error 1

This article has been dead for over six months. Start a new discussion instead.