I have code in the vector array like that:
CODE
#include <Vector.h>
#include <conio.h>
#include <iostream.h>
Vector::Vector(int capacity){
vectorArray = new double[capacity];
maxSize = capacity;
}
void Vector::empty(){
for(int i=0; i<maxSize;i++)
{
vectorArray[i]=0.0;
}
}
void Vector::put_value(int index, double value){
vectorArray[index]= value;
}
double Vector::getFirst(){
first = vectorArray[0];
return first;
}
double Vector::getLast(){
last = vectorArray[maxSize-1];
return last;
}
double Vector::get_value(int index){
// check size out
if(index <0 || index > maxSize){
cout << "\nOut of bound";
return(0);
}
return *(vectorArray + index);
}
int Vector::getSize()
{
return maxSize;
}
void Vector::print()
{
cout << "Array contains the following elements:" << endl<<endl;
for (int i=0; i< maxSize; ++i){
cout << vectorArray[i] << " ";
}
}
so now I want to use it in queue, how can I define class queue?
I get the head file:
#ifndef _Queue_h
#define _Queue_h
#include <Vector.h>
class Queue{
private:
double back, front;
int count;
public:
void pushBack(Vector *v, double p);
void popBack();
double removeQ(Vector *v);
bool isFull();
double empty(Vector *v);
double removeQ(Vector *v);
void front(Vector *v);
void print( const vector<double>& a)
};
#endif