bitmap display

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 9
Reputation: shotjase is an unknown quantity at this point 
Solved Threads: 0
shotjase shotjase is offline Offline
Newbie Poster

bitmap display

 
0
  #1
Apr 30th, 2008
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;

}

}
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 129
Reputation: ivailosp is an unknown quantity at this point 
Solved Threads: 22
ivailosp ivailosp is offline Offline
Junior Poster

Re: bitmap display

 
0
  #2
Apr 30th, 2008
  1. cout << grid[r][c]?'1':'*' << ' ';
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 9
Reputation: shotjase is an unknown quantity at this point 
Solved Threads: 0
shotjase shotjase is offline Offline
Newbie Poster

Re: bitmap display

 
0
  #3
Apr 30th, 2008
when i replaced my cout statement with yours the 0's were still ther?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 129
Reputation: hacker9801 is on a distinguished road 
Solved Threads: 15
hacker9801 hacker9801 is offline Offline
Junior Poster

Re: bitmap display

 
0
  #4
Apr 30th, 2008
is grid an array chars?
  1. cout << (grid[r][c] == '1') ? '1' : '*' << ' ';
or
  1. if(grid[r][c] == '0') cout << '*';
  2. else cout << '1';
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 9
Reputation: shotjase is an unknown quantity at this point 
Solved Threads: 0
shotjase shotjase is offline Offline
Newbie Poster

Re: bitmap display

 
0
  #5
May 1st, 2008
thanks man
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC