i have a file here with all my constructors but i sitll have a problem..it wont compile and i have no idea y..
using namespace std;
bitmap::bitmap()
{
//vector < vector <bool> > g;
numrows = 1;
numcols = 1;
grid.resize(numrows, vector <bool> (numcols,false));
}
void bitmap::display() const
{
for (int r = 0; r < numrows; r++)
{
for (int c = 0; c < numcols; c++)
{
if (grid[r][c] == 0)
cout << " " ;
else cout << "*";
}
cout << endl;
}
}
int bitmap::getRows() const
{
return numrows;
}
int bitmap::getCols() const
{
return numcols;
}
void bitmap::save (string filename) const
{
ofstream infile(filename.c_str());
if (infile.is_open())
{
infile << numrows;
infile << numcols;
for (int r = 0; r < numrows; r++)
{
for (int c = 0; c < numcols; c++)
{
infile << grid[r][c];
}
}
}
else
{
cout <<"Failed to open file" << cout;
}
infile.close();
}
void bitmap::read (string filename)
{
ifstream infile;
infile.open(filename.c_str());
if (infile.fail())
{
cout << "Invalid filename " << endl;
}
if (infile >> numrows >> numcols)
{
grid.resize(numrows, vector <bool> (numcols,false));
char ch;
for (int r = 0; r < numrows; r++)
for (int c = 0; c < numcols; c++)
{
infile >> ch;
grid[r][c] = (ch!= '0');
}
}
}
void bitmap::invert()
{
for (int r = 0; r < numrows; r++)
{
for (int c = 0; c < numcols; c++)
{
if (grid[r][c] = 1)
{
grid[r][c] = 0;
}
else{
grid[r][c] = 1;
}
}
}
}
void bitmap::magnify()
{
//The image is doubled both vertically and horizontally.
}
void bitmap::rotate()
{
//The image is rotated 90 degress clockwise. Note that 4 rotations should return to the original image.
}
can anyone see any problems in my code??