Implement the BitMap class that has the following interface:
class BitMap {
private:
...
public:
BitMap(); // default constructor
BitMap(int N); // constructor that allocates enough memory to store N bits
BitMap(ifstream &finp); // constructor that reads the whole bitmap from the given binary file
~BitMap(); // destructor
bool get_bit(int i); // returns the specified bit (true=1, false=0)
void set_bit(int i, bool value); // sets the specified bit
bool Get(); // returns the current bit
void Put(char bit); // sets the current bit according to the char value: '0'->0 '1'->1
void Put(string bits); // sets a sequence of bits from the current position
void print(); // for debugging purposes provide a tool that prints the whole bitmap as a sequence of 1s and 0s
void DumpToFile(ofstream &fout); // saves the all information from the bitmap into a binary file
};
Note 1: you should maintain that special pointer that points to the current position. In fact, you
need even two such pointers for writing and reading.
Note 2: Please see the example that shows how to deal with binary files.