home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_01 / 9n01127a < prev    next >
Text File  |  1990-03-26  |  1KB  |  36 lines

  1. // Cvector.hpp
  2. #include <stdlib.h>
  3.  
  4. #include "complex.hpp"      
  5. static complex *present;
  6.  
  7. class Cvector {
  8.    protected:
  9.    public:
  10.       int size,base;
  11.       complex *head;
  12.       Cvector(int s=1,int b=0,complex initvalue= complex(0.,0.)) 
  13.          //constructor
  14.          { head= new complex[s];base=b;
  15.            for(size=0,present=head;size<s;
  16.             size++,present++) *present = initvalue; 
  17.            size=s;       
  18.           printf(" Cvector built\n");
  19.          }
  20.       Cvector( Cvector&);   //copy
  21.       ~Cvector()//destructor
  22.          {
  23.          delete head; printf(" Cvector axed\n");}
  24.       void operator=( Cvector& rhs);
  25.       complex operator*(Cvector& rvalue);//dot product
  26.       inline int length()
  27.          {return size;}
  28.       inline complex& elemnt( int i)
  29.          {return head[i-base];}
  30.       inline void setelemnt( int i, complex& value)
  31.          {head[i-base]=value;}
  32.       void check(int);
  33.       complex& element( int i);
  34.       void setelement(int i, complex& value);
  35.    };
  36.