JavaScript is required to use Bungie.net

离题

浏览大量随机讨论。
10/16/2013 9:53:38 PM
3

Anyone good at c++ and willing to help out?

I'm trying to write two functions (three including main) that together, will output the binary versions of numbers 0-10. It seems simple, but the problem is that one of the functions needs to grab each individual bit of a number (1-10, and 16 bits) and the other needs to put those bits together to form a string. The string contains the binary version of x, where x is any number 1-10. From the linked code.. To get the each bit of a number, I'm using the function int bits, which grabs the bits in order, and I'm trying to connect them with bitstring, but as you can see, I've got no clue how to do that. I'm working on that for loop too. Anyone have any ideas? Specifically, how I can put the 'bits' function inside of 'bitstring' and transform it into a string? Output is supposed to be: [spoiler] 0 is: 0000000000000000 1 is: 0000000000000001 2 is: 0000000000000010 3 is: 0000000000000011 4 is: 0000000000000100 5 is: 0000000000000101 6 is: 0000000000000110 7 is: 0000000000000111 8 is: 0000000000001000 9 is: 0000000000001001 10 is: 0000000000001010 [/spoiler] I'll clarify if anything is unclear too. Any help is appreciated.

发贴语言:

 

遵守游戏礼仪。发送贴子前请花点时间阅读我们的行为准则 取消 编辑 创建火力战队 贴子

你没有权限查看此内容。
;
preload icon
preload icon
preload icon