i have this constructor to display a bitmap and it displays with 1's and 0's..i jus need 2 know how 2 make the 0's into *'s...i think its an if statement but i dont know exactly were

void bitmap::display() const
{
     for (int r = 0; r < numrows; r++)
     {
         for (int c = 0; c < numcols; c++)
            cout << grid[r][c] <<  ' ';
         cout << endl;

     }

}
cout << grid[r][c]?'1':'*' << ' ';

when i replaced my cout statement with yours the 0's were still ther?

is grid an array chars?

cout << (grid[r][c] == '1') ? '1'  : '*' << ' ';

or

if(grid[r][c] == '0') cout << '*';
else cout << '1';

thanks man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.