hey guys i have to implement and test a header file here bitmap..implementation uses a 2-dimensional vector of bool called grid and its dimensions, numrows and numcols. A zero is stored as false in the grid and a one is stored as true. The member functions should manipulate grid, numrows and numcols appropriately.
Look below for more details...
#ifndef BITMAP
#define BITMAP
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
// class for black/white bitmaps
class bitmap
{
public:
bitmap(); // default constructor
// generates a 1 cell grid of "off" (0)
void display() const; // post : the grid has been displayed as stars (for filled cells) and
// spaces (for unfilled cells)
int getRows() const; // post : returns the number of rows
int getCols() const; // post : returns the number of columns
void save (string filename) const;
// post : the image has been saved in filename
void read (string filename); // post : the image has been read in from filename
// displays an error message if file is not found
void invert(); // post : image has been inverted (filled cells
// changed to empty and vice versa)
void magnify(); // post : image has been doubled vertically
// and doubled horizontally
void rotate(); // post : image has been rotated 90 degrees clockwise
//
private:
int numrows;
int numcols;
vector < vector <bool> > grid; // the 2-dimensional grid of data
};
#endif
i now have to write an implemtation file for
bitmap::bitmap()
{
// // default constructor
// generates a 1 cell grid of "off" (0)
}
void bitmap::read (string filename)
{
// post : the image has been read in from filename
// displays an error message if file is not found
}
void bitmap::display()
{
// post : the grid has been displayed as stars (for filled cells)
}
can any tell me what code is meant to go inside these constructors...i am just starting on c++ and am not very good at it..thanks