TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 21 Jul 2012 09:48 AM |
How would I do that? I know that 1111 1111 in binary means 255 and that the char goes from 0 to 255. So would I just have to do char(255) in c++? |
|
|
| Report Abuse |
|
|
abx1
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 4979 |
|
|
| 21 Jul 2012 09:50 AM |
Well binary is read from right to left. For each 0, you do nothing, for each 1, you multiply it based off the number you should. Example:
10011000
128 64 32 16 8 4 2 1
You'd get 152. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Jul 2012 09:54 AM |
Wat did I just say?
Trololololol |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 21 Jul 2012 09:54 AM |
I knpw that, thanks, tough. But I mean like converting the num to a char. |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 21 Jul 2012 10:21 AM |
| Yeah, you just do char(unsigned int) |
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 21 Jul 2012 10:24 AM |
| k ill might nake binry decpder when ill come home |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
| |
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
|
| 21 Jul 2012 10:26 AM |
| in car going to bday but were stuck in a traffic jam caused by an accident |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 21 Jul 2012 10:33 AM |
Is that the one you were talking earlier?
|
|
|
| Report Abuse |
|
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
| |
|
TheMyrco
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 15105 |
|
| |
|
|
| 21 Jul 2012 10:49 AM |
| print( tonumber(10101010,2) ) |
|
|
| Report Abuse |
|
|