convert unsigned decimal to binary

aqqq
Last edited on
Are the test cases automated or are they tested one by one manually? If they're automated you will need to keep very close attention to the exact output that is expected, because a single letter in the wrong place could cause the test case to fail. Are you supposed to print a message that asks for a number? The outputs that you listed, are they outputs of your program or expected outputs? Perhaps the problem is that the test cases expect you to always print 16 digits while you only print as many digits that are necessary to show the number.
mm hex is directly convertible to binary.
a small lookup table for hex digits to binary text strings, reformat the numeric value to hex, and the code becomes a lot simpler. I get that you can't change the algorithm but its worth noting that the algorithm is the brute force way.

what are the inputs? Its hard to understand the 'wrong' output without the inputs :)

those outputs are, if it helps,
123
1024
43981
2005


Last edited on
Yea. I am aware of the the table and understand how to convert it by hand, but the professor is expecting us to have convert 4 test cases, whose inputs are 123, 1024, 43981, 2005
I am thinking i have to incorporate those test cases as fixed values and display the output through the use of the algorithm.
Topic archived. No new replies allowed.