Well I dont know where I am going wrong.... I and trying to do this queue with out the STL I am having issues with my enqueue () How do I get the contritor Info into the enqueue.

I am trying to do it as simle as possible and I seem to not be able to get around this one thing. Any help would be nice .

Attachments
//***************************************************************
// TITLE:                      	Contributor	
// FILEInContrib:                   	Contributor.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      		    <MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================

#include <iostream>
#include <string>
#include <iomanip>
#include "Contributor.h"
using namespace std;

///c-tor implementation 
 int num =1;
Contributor::Contributor()
{	
	Name = ""; 
	Contribution = 0.0f; 
	Sex = None;
	IDKey = 0; 
}
//copy C-tor
Contributor::Contributor(string InContrib, double InContribution, Gender InSex, int InIDKey)
{
	Name= InContrib;
    Contribution= InContribution;
	Sex = InSex;
    IDKey= InIDKey;
}
Contributor::Contributor(const Contributor &CCContrib)
{ 
	Name = CCContrib.Name;
	Contribution= CCContrib.Contribution;
	Sex = CCContrib.Sex;
	IDKey = CCContrib.IDKey;
}
ostream &operator <<(ostream & Out,Contributor &InContrib)
 	{  
     	//Out<<endl<<num<<"\tName of the Contributor? " <<endl;
		//Out<<"\tName: " <<InContrib.Name <<endl;
		//Out<<"\tID Number: " <<InContrib.IDKey<<endl;
		//Out<<endl<<num<<endl;
        Out<<"\tContribution: "<<InContrib.Contribution<<".00"<<endl;
		Out<<"\tGender: ";	
 			switch (InContrib.Sex)
			{
				case Male: Out<<" Male ";break; 
				case Female: Out<<" Female ";break;
				//default: Out<<"NONE";break;
     		}
  		num++;
		Out<<endl<<endl; 
		return Out; 
	}
/*istream &operator >> (istream &In,Contributor &InContrib)
	{
		int SelSex = 0;//selection of gender
		In.clear();
		In.ignore(In.rdbuf()->in_avail(), '\n'); 
		cout<<"\tEnter Contirbutors Name: ";
		getline(In,InContrib.Name); 

		cout<<"\tEnter the amount of "<<InContrib.Name <<"'s contribution ";
		In>>InContrib.Contribution; 
		
		cout<<"\tNow Enter an ID# for "<<InContrib.Name<<" ";
		In>>InContrib.IDKey;
		
		cout<<"\twhat is "<<InContrib.Name<<"'s Gender? "<<endl;
		cout<<"\t1. Male. \n\t2. Female \n\t3. None\n\n";
		In >> SelSex;
		switch(SelSex)
			{
				case 1: SelSex = Male; break;
				case 2: SelSex = Female; break;
				case 3: SelSex = None; break;
			}
		return In;
	}
	*/
Contributor &Contributor::operator = (const Contributor & RtSide)
{
	if(this != &RtSide)
	{
		//Name = RtSide.Name;
		Contribution = RtSide.Contribution;
		Sex = RtSide.Sex;
		//IDKey = RtSide.IDKey;
	}	
	return *this;
}
bool Contributor::operator <(const Contributor & RtSide)
	{return (Contribution <RtSide.Contribution);}

bool Contributor::operator >(const Contributor & RtSide)
	{return (Contribution <RtSide.Contribution);}	

bool Contributor::operator ==(const Contributor & RtSide)
	{return ((Name == RtSide.Name)&&(Contribution==RtSide.Contribution)&&(Sex== RtSide.Sex));
	}
bool Contributor::operator !=(const Contributor & RtSide)
	{return((Name != RtSide.Name)||(Contribution!=RtSide.Contribution)||(Sex != RtSide.Sex));
	}
// TITLE:                      	Contributor	
// FILENAME:                   	Contributor.h
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      			<MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h ,contributor.cpp, Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//
//================================================================
//              PROCESS THIS FILE ONLY ONCE PER PROJECT
#ifndef	CONTRIBUTOR_H 
#define	CONTRIBUTOR_H
#include <iostream>
#include <string>
using namespace std;
//================================================================
//CONSTANT DEFINITIONS
enum Gender {Male=0, Female, None};                       
class Contributor
{
friend ostream &operator <<(ostream & Out,Contributor &InContrib);
friend istream &operator >>(istream & In, Contributor &InContrib);

public:	
	Contributor();
	Contributor(string InContrib, double InContribution, Gender inSex, int InIDKey);
	Contributor(const Contributor &CCContrib);
	
/////Overloaded Operators
	Contributor &operator=(const Contributor & RtSide);
	bool operator <(const Contributor & RtSide);
	bool operator >(const Contributor & RtSide);
 	bool operator ==(const Contributor & RtSide);
	bool operator!=(const Contributor & RtSide);
	bool insertNode(Contributor i);

private:
	string Name;
	double Contribution;
	Gender Sex;
	int IDKey;	
};

#endif
//***************************************************************
// TITLE:                      	Table Seating
// File:                        lab3.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      		    <MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab3.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================
//		INCLUDE FILES
#include<iostream>
#include<string>
#include<list>
#include<cstdlib>   
#include<stack>
#include<cassert>
#include<ctime>	  
#include "contributor.h"
using namespace std;
//
//*****************************************************************************
//		BEGINNING OF MAIN PROGRAM CODE
//*****************************************************************************
int main()
    {      
        int num=1; 
      	list <Contributor> F_list; //make a list of contributors
        list <Contributor> M_list;
     	list <Contributor>::iterator F_ITR = F_list.begin();//this is initializes the iterator
      	list <Contributor>::iterator M_ITR = M_list.begin();
       	stack <Contributor> F_stack;//makes the stacks for Male/Female
        stack <Contributor> M_stack;
        stack <Contributor>LHS_stack;//Makes the left side of the table 
        stack <Contributor>RHS_stack;
        stack <Contributor>rTable_stack;//makes the table stack
	
////////////////////Prof Thors generator for contributors			
        srand ((unsigned) time (NULL)); 
            for(int counter=0; counter<100;counter++)
		        {
	              double Con=rand()% 1000;
			      int Sex=rand()%10; 			
                  if(Sex<4)
                     {
                      Contributor Dude("Male", Con, Male, 1001); 	
			          M_list.insert(M_ITR, Dude);
                     }else{
                      Contributor lady("Lady", Con, Female, 0110); 	
			          F_list.insert(F_ITR, lady);	
                     }
                }
////////////////Double sort so the contributions are high /low - low/high///////////
    	M_list.sort();
		F_list.sort();                  
		M_list.sort();
        F_list.sort();

        for(M_ITR=M_list.begin(); M_ITR!=M_list.end(); ++M_ITR)
           {
		    M_stack.push(*M_ITR);				
           }		
		for(F_ITR=F_list.begin(); F_ITR!=F_list.end(); ++F_ITR)
           {
            F_stack.push(*F_ITR);		        
           }
        cout<<"F_stack(" << (int) F_stack.size() <<")"<<endl;
        cout<<"M_stack(" << (int) M_stack.size() <<")"<<endl;
  
//////////////Alternates the contributors o place them on the table
       for(int i = 0; i <100; i++)
          {
             if((!M_stack.empty()) && (!F_stack.empty()))
	            {
	              LHS_stack.push(M_stack.top()); 
	              M_stack.pop();
	            }
	         if((!M_stack.empty()) && (!F_stack.empty()))
	            {
	              RHS_stack.push(F_stack.top());
	              F_stack.pop();
	            }
             if((!M_stack.empty()) && (!F_stack.empty()))
	            {
	              RHS_stack.push(M_stack.top());
	              M_stack.pop();
	            }
             if((!M_stack.empty()) && (!F_stack.empty()))
	            {
		          LHS_stack.push(F_stack.top());
		          F_stack.pop();
	            }
           }
      // cout<<"Male stack: "<<M_stack.size()<<endl;
      //cout<<"Female stack: "<<F_stack.size()<<endl<<endl;
       cout<<"Left side: "<<LHS_stack.size()<<endl;
       cout<<"Right side: "<<RHS_stack.size()<<endl<<endl;
//Places the remaining contributors on opposite sides of the table
	   while(!M_stack.empty())
            {
             if(!M_stack.empty())
                {
                 LHS_stack.push(M_stack.top());  
                 M_stack.pop();	  
                }
             if(!M_stack.empty())
                {
                 RHS_stack.push(M_stack.top());	
                 M_stack.pop();
                }
            }									  
       while(!F_stack.empty())
            {
             if (!F_stack.empty())
	            {
	             LHS_stack.push(F_stack.top());  
	             F_stack.pop();
	             }
             if (!F_stack.empty())
                {
                 RHS_stack.push(F_stack.top());	
	             F_stack.pop();
                }
            }

       while (!RHS_stack.empty())
            {
	         rTable_stack.push(RHS_stack.top());
	         RHS_stack.pop();
            }
       while(!LHS_stack.empty()) 
            {
	         cout<<" "<<LHS_stack.top();
	         LHS_stack.pop();
            }	
	        cout<<endl;
	        cout<<"RHS Table"<<endl<<"Guest Speaker:Guest Speaker"<<endl<<"LHS Table"<<endl<<endl<<endl;
	        		
       while(!rTable_stack.empty())
           {
	        cout<<" "<<rTable_stack.top();
	        rTable_stack.pop();
           }
      cin>>num;
return 0;
}
//******************************************************************************
//		END OF MAIN PROGRAM CODE
//******************************************************************************
F_stack(61)
M_stack(39)
Left side: 39
Right side: 38

        Contribution: 79.00
        Gender:  Female

        Contribution: 97.00
        Gender:  Female

        Contribution: 123.00
        Gender:  Female

        Contribution: 149.00
        Gender:  Female

        Contribution: 184.00
        Gender:  Female

        Contribution: 230.00
        Gender:  Female

        Contribution: 255.00
        Gender:  Female

        Contribution: 282.00
        Gender:  Female

        Contribution: 289.00
        Gender:  Female

        Contribution: 313.00
        Gender:  Female

        Contribution: 361.00
        Gender:  Female

        Contribution: 385.00
        Gender:  Female

        Contribution: 12.00
        Gender:  Male

        Contribution: 398.00
        Gender:  Female

        Contribution: 76.00
        Gender:  Male

        Contribution: 407.00
        Gender:  Female

        Contribution: 106.00
        Gender:  Male

        Contribution: 441.00
        Gender:  Female

        Contribution: 153.00
        Gender:  Male

        Contribution: 486.00
        Gender:  Female

        Contribution: 198.00
        Gender:  Male

        Contribution: 511.00
        Gender:  Female

        Contribution: 229.00
        Gender:  Male

        Contribution: 543.00
        Gender:  Female

        Contribution: 289.00
        Gender:  Male

        Contribution: 589.00
        Gender:  Female

        Contribution: 299.00
        Gender:  Male

        Contribution: 622.00
        Gender:  Female

        Contribution: 355.00
        Gender:  Male

        Contribution: 678.00
        Gender:  Female

        Contribution: 408.00
        Gender:  Male

        Contribution: 721.00
        Gender:  Female

        Contribution: 499.00
        Gender:  Male

        Contribution: 748.00
        Gender:  Female

        Contribution: 624.00
        Gender:  Male

        Contribution: 778.00
        Gender:  Female

        Contribution: 666.00
        Gender:  Male

        Contribution: 803.00
        Gender:  Female

        Contribution: 698.00
        Gender:  Male

        Contribution: 819.00
        Gender:  Female

        Contribution: 733.00
        Gender:  Male

        Contribution: 884.00
        Gender:  Female

        Contribution: 760.00
        Gender:  Male

        Contribution: 932.00
        Gender:  Female

        Contribution: 864.00
        Gender:  Male

        Contribution: 960.00
        Gender:  Female

        Contribution: 909.00
        Gender:  Male

        Contribution: 967.00
        Gender:  Female

        Contribution: 968.00
        Gender:  Male

        Contribution: 991.00
        Gender:  Female

        Contribution: 998.00
        Gender:  Male


			RHS Table
	Guest Speaker:Guest Speaker
			LHS Table


        Contribution: 992.00
        Gender:  Female

        Contribution: 971.00
        Gender:  Male

        Contribution: 982.00
        Gender:  Female

        Contribution: 928.00
        Gender:  Male

        Contribution: 966.00
        Gender:  Female

        Contribution: 902.00
        Gender:  Male

        Contribution: 952.00
        Gender:  Female

        Contribution: 763.00
        Gender:  Male

        Contribution: 931.00
        Gender:  Female

        Contribution: 746.00
        Gender:  Male

        Contribution: 836.00
        Gender:  Female

        Contribution: 700.00
        Gender:  Male

        Contribution: 807.00
        Gender:  Female

        Contribution: 695.00
        Gender:  Male

        Contribution: 789.00
        Gender:  Female

        Contribution: 624.00
        Gender:  Male

        Contribution: 769.00
        Gender:  Female

        Contribution: 579.00
        Gender:  Male

        Contribution: 728.00
        Gender:  Female

        Contribution: 426.00
        Gender:  Male

        Contribution: 694.00
        Gender:  Female

        Contribution: 391.00
        Gender:  Male

        Contribution: 642.00
        Gender:  Female

        Contribution: 299.00
        Gender:  Male

        Contribution: 612.00
        Gender:  Female

        Contribution: 298.00
        Gender:  Male

        Contribution: 558.00
        Gender:  Female

        Contribution: 288.00
        Gender:  Male

        Contribution: 532.00
        Gende
//***************************************************************
// TITLE:                      	Contributor	
// FILEInContrib:                   	Contributor.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      		    <MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================

#include <iostream>
#include <string>
#include <iomanip>
#include "Contributor.h"
#include "myQueue.h"
using namespace std;

myQueue::myQueue()   // I don't see all your class constructors here...also, you redefine the size of ArrayQ to [2] instead of the original [7] in the header
	{				 // I would also initialize some null values (0 or null) since you are declaring them here, especially
		front;		 // the array since there is nothing in it right now but trash.
		rear;
		Index;
		size;
		ArrayQ[10];
		//cout<<ArrayQ<<front<<rear<<Index<<size<<endl;
	}

	myQueue::~myQueue()
	{
		cout<<"Qdtor ran"<<endl;
	}

	bool myQueue::IsEmpty()
	{
		if (Index == 0){return true;}
		else{return false;} 
	}
	
	bool myQueue::IsFull()
	{
		cout<<"the size is :"<<size<<endl;
		cout <<"the index is: " << Index<< endl;
		if (Index == size){return true;}
		else{return false;}
	}

	bool myQueue::enqueue( const myQueue &Contributor())
	{
		if(IsFull()){cout<<"this is myQueue is FULL"<<endl;}
		else 
		{
			if((front ==rear)&&(size == 0))   
				ArrayQ[rear]= (Contributor());
		}
		if(IsEmpty())
		{
			if(front==size ){front= 0;}    
			if (rear==size){rear= 0;}
			ArrayQ[rear]= (Contributor()); 
			rear ++;
		}
		
	}
	
	bool myQueue::dequeue ()    
{
	delete ArrayQ[front]= NULL;          
	++front;
}

void myQueue::InFront()
{
	cout<<ArrayQ[front]<<endl;
}

void myQueue::InRear()
{
	cout<<ArrayQ[rear]<<endl;
}
	
myQueue operator=(myQueue &RHS)
{
	
}

myQueue (const myQueue &CCmyQueue)
{
	
}
#ifndef	myQueue_H
#define myQueue_H
#include <iostream>
#include <string>
#include "Contributor.h"
using namespace std;

class myQueue
{
public:
	myQueue();
	myQueue(const myQueue & CCqueue);
	myQueue & operator = (const myQueue & RHS);
	~myQueue();
	
	int ArrayQ[10];
	bool enqueue(const myQueue &Contributor());
	bool dequeue();
	bool IsEmpty();
	bool IsFull();
	void InFront();
	void InRear();
	
private:
	int front;//this is front
	int rear;//this is rear
	int Index;
	int size;
	
};

#endif

If you want to enqueue Contributors, why do you use an int array? And why the () in the parameter of enqueue()? Do you want to enqueue Contributor objects or pointers to Contributor objects?

And a style hint:

if (Index == size){return true;}
		else{return false;}

is the same as

return Index == size;

How would you do either or both (enqueue contributor objects or pointers to the contributor objects) I guess would be my question. As a beginner as well, I'm not sure how you would pass either into the function.

I copied the code and started changing how it's done and no matter how I do it, I get errors. Some that say not an overloaded function, some that say cannot convert from int, and some that say something about referencing a non constant object

I would also ask (dunno if Phil wants to know this also) how would this be implemented in main?

wellI rewrote the MyQueue.h and cpp but I cant get it to work.
1. myQueue &operator = (myQueue & RHS);
2 . I dont know if my enqueue() is correct.

gerry .. if you found a way .. let me know

Attachments
//***************************************************************
// TITLE:                      	Contributor	
// FILE:						Contributor.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      		    <MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================

#include <iostream>
#include <string>
#include <iomanip>
#include "Contributor.h"
#include "myQueue.h"
using namespace std;

///c-tor implementation 
 int num =1;
Contributor::Contributor()
{	
	Name = ""; 
	Contribution = 0.0f; 
	Sex = None;
	IDKey = 0; 
}
//copy C-tor
Contributor::Contributor(string InContrib, double InContribution, Gender InSex, int InIDKey)
{
	Name= InContrib;
    Contribution= InContribution;
	Sex = InSex;
    IDKey= InIDKey;
}
Contributor::Contributor(const Contributor &CCContrib)
{ 
	Name = CCContrib.Name;
	Contribution= CCContrib.Contribution;
	Sex = CCContrib.Sex;
	IDKey = CCContrib.IDKey;
}
ostream &operator <<(ostream & Out,Contributor &InContrib)
 	{  
     	//Out<<endl<<num<<"\tName of the Contributor? " <<endl;
		//Out<<"\tName: " <<InContrib.Name <<endl;
		//Out<<"\tID Number: " <<InContrib.IDKey<<endl;
		//Out<<endl<<num<<endl;
        Out<<"\tContribution: "<<InContrib.Contribution<<".00"<<endl;
		Out<<"\tGender: ";	
 			switch (InContrib.Sex)
			{
				case Male: Out<<" Male ";break; 
				case Female: Out<<" Female ";break;
				//default: Out<<"NONE";break;
     		}
  		num++;
		Out<<endl<<endl; 
		return Out; 
	}
/*istream &operator >> (istream &In,Contributor &InContrib)
	{
		int SelSex = 0;//selection of gender
		In.clear();
		In.ignore(In.rdbuf()->in_avail(), '\n'); 
		cout<<"\tEnter Contirbutors Name: ";
		getline(In,InContrib.Name); 

		cout<<"\tEnter the amount of "<<InContrib.Name <<"'s contribution ";
		In>>InContrib.Contribution; 
		
		cout<<"\tNow Enter an ID# for "<<InContrib.Name<<" ";
		In>>InContrib.IDKey;
		
		cout<<"\twhat is "<<InContrib.Name<<"'s Gender? "<<endl;
		cout<<"\t1. Male. \n\t2. Female \n\t3. None\n\n";
		In >> SelSex;
		switch(SelSex)
			{
				case 1: SelSex = Male; break;
				case 2: SelSex = Female; break;
				case 3: SelSex = None; break;
			}
		return In;
	}
	*/
Contributor &Contributor::operator = (const Contributor & RtSide)
{
	if(this != &RtSide)
	{
		//Name = RtSide.Name;
		Contribution = RtSide.Contribution;
		Sex = RtSide.Sex;
		//IDKey = RtSide.IDKey;
	}	
	return *this;
}
bool Contributor::operator <(const Contributor & RtSide)
	{return (Contribution <RtSide.Contribution);}

bool Contributor::operator >(const Contributor & RtSide)
	{return (Contribution <RtSide.Contribution);}	

bool Contributor::operator ==(const Contributor & RtSide)
	{return ((Name == RtSide.Name)&&(Contribution==RtSide.Contribution)&&(Sex== RtSide.Sex));
	}
bool Contributor::operator !=(const Contributor & RtSide)
	{return((Name != RtSide.Name)||(Contribution!=RtSide.Contribution)||(Sex != RtSide.Sex));
	}
// TITLE:                      	Contributor	
// FILENAME:                   	Contributor.h
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      			<MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h ,contributor.cpp, Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//
//================================================================
//              PROCESS THIS FILE ONLY ONCE PER PROJECT
#ifndef	CONTRIBUTOR_H 
#define	CONTRIBUTOR_H
#include <iostream>
#include <string>
#include "myQueue.h"
using namespace std;
//================================================================
//CONSTANT DEFINITIONS
enum Gender {Male=0, Female, None};                       
class Contributor
{
friend ostream &operator <<(ostream & Out,Contributor &InContrib);
friend istream &operator >>(istream & In, Contributor &InContrib);

public:	
	Contributor();
	Contributor(string InContrib, double InContribution, Gender inSex, int InIDKey);
	Contributor(const Contributor &CCContrib);
	
/////Overloaded Operators
	Contributor &operator=(const Contributor & RtSide);
	bool operator <(const Contributor & RtSide);
	bool operator >(const Contributor & RtSide);
 	bool operator ==(const Contributor & RtSide);
	bool operator!=(const Contributor & RtSide);
	bool insertNode(Contributor i);

private:
	string Name;
	double Contribution;
	Gender Sex;
	int IDKey;	
};

#endif
//***************************************************************
// TITLE:                      	Contributor	
// FILE:						Contributor.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/13/08>
// COMPILER USED:       		<MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab1.cpp
//		myQueue.h, myQueue.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================

#include <iostream>
#include <string>
#include <list>
#include "Contributor.h"
#include "myQueue.h"

using namespace std;

int main()
{
	myQueue ObjQue;// this makes the Queue

		Contributor A("Phillip", 19.70, Male, 38);
		Contributor B("Joanna", 19.69, Female, 39);
		Contributor C("Hannah", 19.99, Female, 9);
		Contributor D("Rachel", 20.01, Female, 7);
		Contributor E("Raymond",19.48, Male, 59);
		Contributor F("Dottie", 19.52, Female, 55);
		Contributor G("Amanda", 19.68, Female, 40);
		Contributor H("David", 19.71, Male, 37);
		ObjQue.enqueue(A);
		cout<<"front is :"<<ObjQue.front()<<ObjQue.rear()<<endl;
	cout<<"this is the main driver"<<endl;
	return 0; 
}
//***************************************************************
// TITLE:                      	Contributor	
// FILEInContrib:                   	Contributor.cpp
// PREPARED FOR:               	CS230 Section <section number>
// PROGRAMMER(S):              	< Phillip Harris>
// DEVELOPMENT DATE:           	< 07/09/08>
// COMPILER USED:      		    <MS visual studio 2005>
// TARGET PLATFORM:         	< WIN XP >
//================================================================
//                           PROJECT FILES
//    	contributor.h, contributor.cpp,	Lab1.cpp
//================================================================
//                          REVISION HISTORY
//   DATE     PROGRAMMER            DESCRIPTION OF CHANGES MADE
//	<07/08/08	Phil Harris				Original >
//================================================================

#include <iostream>
#include <string>
#include <iomanip>
#include "Contributor.h"
#include "myQueue.h"
using namespace std;

myQueue::myQueue()
{
	front=0;
	rear =0;
	Index=0;
	size =0;
} 
myQueue::myQueue(const myQueue & CopymyQueue)
{
	for(int i=0; i<CopymyQueue.Index; i++)
		{			
			ArrayQ[i]=CopymyQueue.ArrayQ[i]; 
			front= CopymyQueue.front;
			rear =CopymyQueue.rear;
			Index=CopymyQueue.Index;
			size =CopymyQueue.size;
		}
}
myQueue::~myQueue()
{
	cout<<"The D-tor"<<endl;
}
bool myQueue::IsEmpty()
	{
		if((front==rear)&&(Index==0))
		{
			return true;
		}else{
			return false;
		}
	}
bool myQueue::IsFull()
	{
		if((front==rear)&&(Index==size))
		{
			return true;
		}else{
			return false;
		}
	}	
void myQueue::step(int &num)
{
	if(num==(size-1)){num=0;}
	else{num++;}
}

bool myQueue::enqueue(Contributor::Contributor(string InContrib, double InContribution, Gender inSex, int InIDKey))
{
	if(IsFull())
	{
		cout<< "Can't add anymore..the Queue is full"<<endl;
	}else{
		ArrayQ[rear]= 10;
		step(rear);
		Index++;
		return true;
	}
return true;
}
bool myQueue::dequeue()
{
	if(IsEmpty())
	{
		cout<< "Can't add anymore..the Queue is full"<<endl;
	}else{
		ArrayQ[front]= 2;
		step(front);
		Index--;
		return true;
	}
return true;
}

void myQueue::ShowFront(){cout<<front<<endl;}
void myQueue::ShowRear(){cout<<rear<<endl;}

myQueue &operator = (myQueue & RHS);
{
	if(this!= &RHS)
	{
	  for (int i=0; i<RHS.Index;i++)
	  {

		ArrayQ[i]= RHS.ArrayQ[i];
		Index = RHS.Index;
		rear= RHS.rear;
		front= RHS.front;
		size= RHS.size;
	  }
	}
}
#ifndef	myQueue_H 
#define myQueue_H
#include <iostream>
#include <string>
#include "Contributor.h"
using namespace std;

class myQueue
{
public:
	myQueue(); 
	myQueue(const myQueue & CopymyQueue);
	myQueue & operator =(myQueue & RHS); 
	~myQueue();
	int num;
	int ArrayQ[10];
	bool enqueue(Contributor::Contributor(string InContrib, double InContribution, Gender inSex, int InIDKey));
	bool dequeue(); 
	bool IsEmpty();
	bool IsFull();
	void step(int &num);
	void ShowFront();
	void ShowRear();
	
private:
	int front;//this is front
	int rear;//this is rear
	int Index;
	int size;

};

#endif

Phil, I'll have another look in the AM, I got on kinda late

I was still working on your last version, and I might have a clue now...lol.

Are we missing a "const" before the myQueue within the parentheses?

Also, do we need to pass all that info individually in the enqueue function? I don't think so. We should be able to pass it just like we did with the linked list, by using (Contributor In) or something like that.

got the overloaded = function fixed, but still not sure how to pass the contributor object into the enqueue function

bool enqueue(Contributor const & contributor);

or

bool enqueue(Contributor const * contributor);

or something like that. I don't know, if you want to pass contributor by refenrence o by pointer.

Phil,

I have your queue stuff all figured out except for one thing, and I'll post that as a separate question.

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