Math coding to convert decimal to BCD

I am in class and my professor wants me to create a dialog box that once a decimal value is entered (0-999). The individual decimal number in the hundreds place will need to solve for box 1, then the tenths decimal solve for box2 and the ones solve for box3 and will need to have 12 led lights correspond to the boxes that will have been converted to BCD. So, if box 1=9 then box1 is 1001 and the lights will need to be on-off-off-on sequence for each box has its own lights that are labeled 1-12. I have tried a few things and can only solve for the hundreds place but box2 and 3 come out to (ex… 0.34,0.0033444) not BCD. I’m irritated and the professor is not that much help.

What program are you using?

1 Like

I believe it’s C++ the program is Microsoft visual community 2017

Here is example if the program