1.A bit vector is a vector with binary elements, that is, each element is either a 0 or a 1. Small bit vectors are conveniently represented by unsigned integers. For example, an unsigned char can represent a bit vector of 8 elements. Larger bit vectors can be defined as arrays of such smaller bit vectors. Complete the implementation of the Bitvec class, as defined below. It should allow bit vectors of any size to be created and manipulated using the associated operators.

Code:
enum Bool {false, true};  
typedef unsigned char uchar;    
class BitVec {  
public:     
BitVec       (const short dim);     
BitVec       (const char* bits);     
BitVec       (const BitVec&);     
~BitVec    (void)       
 { delete vec; 
}     
BitVec& operator =    (const BitVec&);     
BitVec& operator &=   (const BitVec&);
BitVec& operator |=   (const BitVec&);    
BitVec& operator ^=   (const BitVec&);    
BitVec& operator <<=  (const short);     
BitVec& operator >>=  (const short);    
 int    operator []    (const short idx);     
void   Set       (const short idx);     
void   Reset        (const short idx);       
BitVec  operator ~    (void);     
BitVec  operator &    (const BitVec&);     
BitVec  operator |    (const BitVec&);    
 BitVec  operator ^    (const BitVec&);    
 BitVec  operator <<   (const short n);    
 BitVec  operator >>   (const short n);     
Bool   operator ==   (const BitVec&);     
Bool   operator !=    (const BitVec&);     
friend ostream& operator << (ostream&, BitVec&);    
private:     uchar  *vec;        // vector of 8*bytes bits     
short   bytes;       // bytes in the vector  
};