Binary to Hex to Binary

My sister recently asked me to write a c++ program which would convert binary to hex and vice versa. I have no idea why she needed it, but I took up on it and this is what I came up with. It’s not particularly elegant, but it gets the job done and I think what I find most interesting about this approach is that it doesn’t involve any math other than calculating some simple string manipulation, but the actual conversion between number systems is done completely through “language translation.”

photo credit: mandolux via photopin cc

Leave a Reply