I was just wondering if anyone can help me out here. I made a program that converts text to binary code but I don't know how to reverse it to do the opposite(binary to text). Here is the part of my source code that converts the text. Any help would be greatly appreciated.
I'm surprised nobody responded to this yet, although your use of non-standard C++ (CLI, I believe) might be what drove a few of us off.
I'll give you a few pointers, and let's see what you do with that.
1) An ASCII character is 8 bits long.
2) Not all bits are worth the same base-10 number, but each set of 8 is worth up to 255.
3) If a character's value is '0', the number it represents is 0. No exceptions.
4) The numbers represented by a '1' are always a power of two with one possible exception.
5) Depending on how your conversion works, the represented numbers either increase or decrease within each set of 8 before resetting, with also one possible exception.
6) The exception mentioned above is that one of the charaacters may represent a signature, indicating whether the number is positive or negative. Keep an eye out for this.
7) Each set of 8 is intended to be summed, resulting in one ASCII character value, unless there is a signature in which case the majority of the values are meant to be summed, with that one signature indicating the positive or negative state of the value.
8) The use of a few for loops will do everything you need. I suggest that you try to use ANSI C++ when possible, and here it's most certainly possible. :)
Sorry with the delayed response. Lol I didn't know I was using a non-standard C++, my bad haha. I will definitely try your pointers :) and I will use ANSI C++ as well. Thanks so much!