I am writing a program that reads customer info from a file, then reads transactions from another. I am building my ADTs for this as I cannot use templates for this class yet and have a cpl of issues. The linked list contains the clientID as an int and a Queue with max of 4 entries that has nodes. The nodes contain an int and a double. I am attaching files for convienence
I think I am not creating an instance in my constructor or something similar. The errors from compiling the ADTs only are as follows.
Thanks

g++ green.h Green.cc Queue.h Queue.cc -c
Green.cc: In constructor `ClientList::ClientList()':
Green.cc:20: error: `data' was not declared in this scope
green.h: In constructor `Customer::Customer()':
green.h:21: error: no matching function for call to `Queue::Queue()'
Queue.h:34: note: candidates are: Queue::Queue(const Queue&)
Queue.h:33: note: Queue::Queue(QueueNode)
Green.cc: In constructor `ClientList::ClientList()':
Green.cc:20: note: synthesized method `Customer::Customer()' first required here

Attachments
#include "Boolean.h"
#include "Queue.h"
#include "green.h"
#include <iostream>
#include <ostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cstdlib>

using namespace std;




ClientList::ClientList()						// constructor
{
	
	data = new Customer;
	head = NULL;
}


ClientList::ClientList(const ClientList &obj)	// copy constructor
{
	ListNode *NodePtr;
	ListNode **NewListPtr;
	head = NULL;
	NewListPtr = &head;
	for(NodePtr = obj.head; NodePtr != NULL; NodePtr->next)
		{
			*NewListPtr = new ListNode;
			(*NewListPtr)->data = NodePtr->data;
			(*NewListPtr)->next = NULL;
			NewListPtr = &((*NewListPtr)->next);
		}
}												// end copy constructor


ClientList::~ClientList()						//destructor
{
	ListNode *NodePtr;
	ListNode *NextNode;
	
	NodePtr = head;
	while (NodePtr != NULL)
	{
		NextNode = NodePtr->next;
		delete NodePtr;
		NodePtr = NextNode;
	}
}




bool ClientList::Insert(Customer newData)			
{
	ListNode *NewPtr;
	ListNode *NodePtr;
	ListNode *PrevPtr = NULL;
	bool success;


	cout << " insert start" << endl;

	// get memory and inititalize
	NewPtr = new ListNode;
	NewPtr->data = newData;

	if (!head)
	{
		head = NewPtr;
		NewPtr->next = NULL;
		success = true;
	}
	else
	{
		NodePtr = head;
		PrevPtr = NULL;
		while(NodePtr != NULL && NodePtr->data.ClientID < newData.ClientID)
		{
			PrevPtr = NodePtr;
			NodePtr = NodePtr->next;
		}
		if(NodePtr != NULL && NodePtr->data.ClientID == newData.ClientID)
		{
			delete NewPtr;
			success = false;
		}
		 // insert the node
		else
		{
			success = true;
			if(PrevPtr == NULL) 
			{
 				head = NewPtr;
				NewPtr->next = NodePtr;
			}
			else
			{
				PrevPtr->next = NewPtr;
				NewPtr->next = NodePtr;
			}
		}
	}
   cout << "end insert";  
return success;
}// end insert

bool ClientList::View(int target, Customer &viewdata)
{
	bool success = false;
	ListNode *NodePtr;
	NodePtr = head;
	while(NodePtr != NULL && NodePtr->data.ClientID < target)
	{
		NodePtr = NodePtr->next;
	}
	if(NodePtr == NULL || NodePtr->data.ClientID != target)
		success = false;
	else
	{
		success = true;
		viewData = NodePtr->data;
	}
	return success;
}// end of View



bool ClientList::Delete(int target)
{
	bool success = false;
	ListNode *NodePtr;
	ListNode *PrevNodePtr;
	
	if(!head)
		success = false;
	else if(head->data.ClientID == target)
	{
		NodePtr = head->next;
		delete head;
		head = NodePtr;
                success = true;
	}
	else
	{
		NodePtr = head;
		while(NodePtr != NULL && NodePtr->data.ClientID < target)
		{
			PrevNodePtr = NodePtr;
			NodePtr = NodePtr->next;
		}
		if(NodePtr == NULL || NodePtr->data.ClientID != target)
			success = false;
		else
		{
			PrevNodePtr->next = NodePtr->next;
			delete NodePtr;
			success = true;
		}
	}
	return success;
}// end of Delete
#include "Boolean.h"
#include "Queue.h"
#include <iostream>
#include <ostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cstdlib>

using namespace std;



struct Customer
			{
			int ClientID;
			int Purchases;
			Queue PurchaseHistory[4];
			
			};

class ClientList
{
	private:
		struct ListNode
			{
				Customer data;
				struct ListNode *next;
			};
		ListNode *head;

	public:
	
	ClientList();								// constructor
	ClientList(const ClientList &obj);			// copy constructor
	~ClientList();								//destructor
	bool Delete(int target);
	bool Insert(Customer data);
	bool View(int target, Customer &viewdata);
	
};

// end ClientList
#include "Queue.h"
#include <iostream>
#include <ostream>
#include <iomanip>
#include "Boolean.h"
#include <string>
#include <fstream>
#include <cstdlib>

using namespace std;

Queue::Queue(QueueNode Purchase)
{
	front = -1;
	rear = -1;
	numitems = 0;
}

Queue::~Queue()
{
	delete[]QueueArray;
}

Queue::Queue(const Queue &obj)
{
	this->QueueArray = new QueueNode[obj.QueueSize];
	QueueSize = obj.QueueSize;
	front = obj.front;
	rear = obj.rear;
	numitems = obj.numitems;
	for (int count = 0; count LT obj.QueueSize;count++)
	{
		QueueArray[count] = obj.QueueArray[count];
	}
}



bool Queue::Enqueue(QueueNode Purchase)
{
	bool Status;
	if (IsFull())
	{
		cout << "Error:Queue Full!\n";
		Status = false;
	}
	else
	{
		rear = (rear + 1) % QueueSize;
		QueueArray[rear] = Purchase;
		numitems++;
		Status = true;
	}
	return Status;
}
bool Queue::Dequeue(QueueNode &Purchase)
{
	bool Status;
	if (IsEmpty())
	{
		cout << "Error:Queue is Empty\n";
		Status = false;
	}
	else
	{
		front = (front + 1) % QueueSize;
		Purchase = QueueArray[front];
		numitems++;
		Status = true;
	}
	return Status;
}

bool Queue::IsEmpty() const
{
	bool Status;
	if(numitems)
	{
		Status = false;
	}
	else
		Status = true;
	return Status;
}
bool Queue::IsFull() const
{
	bool Status;
	if(numitems < QueueSize)
	{
		Status = false;
	}
	else
		Status = true;
	return Status;
}
#ifndef QUEUE_H
#define QUEUE_H


#include <iostream>
#include <ostream>
#include <iomanip>
#include "Boolean.h"
#include <string>
#include <fstream>
#include <cstdlib>

using namespace std;

struct QueueNode
{
	int Shares;
	double Price;
};

class Queue
{
private:
	QueueNode *QueueArray;
	int QueueSize;
	int front;
	int rear;
	int numitems;
	

	
public:
	Queue(QueueNode);
	Queue(const Queue&);
	bool Enqueue(QueueNode);
	bool Dequeue(QueueNode&);
	bool IsEmpty() const;
	bool IsFull() const;
	void clear();
	~Queue();
};
#endif

reen.cc:20: error: `data' was not declared in this scope

To help you start, the line

data = new Customer;

in

ClientList::ClientList()						// constructor
{
	
	data = new Customer;
	head = NULL;
}

is actually a member of the structure ListNode

struct ListNode
			{
				Customer data;
				struct ListNode *next;
			};

With that in mind, you will need to figure out how to access data with this information.

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