using namespace std;

#ifndef _Vectorclass_hpp_
#define _Vectorclass_hpp_

class Vectorclass
{
      int size;
      float *array;
      
      public:
             Vectorclass();     // Default constructor
             Vectorclass(int ); // Assign constructor
             ~Vectorclass();    // Destructor
             
             void set(float *a, int k);
             void setvalue(int index, float val);
             void printv();
      };
      

Vectorclass::Vectorclass()
{
      size = 1;
      array = new float[size];
      array[0] = 0;
}

Vectorclass::Vectorclass(int k)
{
      size = k;
      array = new float[size];
      for (int i=0; i<size; i++) array[i] = 0.0;
}

Vectorclass::~Vectorclass()
{
      delete[] array;
}

void Vectorclass::set(float *vec, int k)
{
      if (k != size)
         cout << " Error in vector dimensions\n";
      else
          for (int i=0; i<k; i++) array[i] = vec[i];
}

void Vectorclass::setvalue(int index, float value)
{
     if (index >= size)
         cout << " Error in vector dimensions\n";
      else
         array[index] = value;
}         

void Vectorclass::printv()
{
     cout << " ( ";
     for (int i=0; i<size-1; i++) cout << array[i] << ", ";
     cout << array[size-1] << " )\n";
}

#endif
