AtomicX wrote: |
---|
Hey guys, I am trying to do a simple program where I ask the user how many bits they want to be represented, then ask what ASCII character they want to convert to binary and output the binary. For instance, if a user wants to use 7 bits and use the ascii 7, it should display 0110111. If they wanted 8 bits it would be 00110111 and if they wanted 9 bits it would be 000110111 etc etc. Right now I am using bitset to convert from ASCII to binary, but I see I can only do this by declaring how many bits I want rather then take what the user inputs by using bitset<Number of bits here> binary(user's ASCII); |