![]() Only when you have a working algorithm and code that you believe implements that algorithm but doesn't produce the correct result do you need to post here. ![]() At every step, you can compare the code to the algorithm to confirm that it does what it is supposed to do. If it works for a manual process then it will work in code, so you can then write code to implement the algorithm specifically. Offline vb dev over 11 years ago in reply to ImPer Westermark Thanks Per, I had used wrong line of code. There is a big reason why the C language allows us to perform mathematical operations directly using characters. ![]() Formalise those steps into an algorithm and follow that algorithm. bcdvalue ( asciitext 0 - '0') << 4 Suddenly, no comment is needed since there is no longer any magic value 48 to explain. Think about the steps that need to be performed and perform them. Put the code away for now and do the process manually. ![]() the steps to get to a result rather than just the result. This is what happens when you try to write code without knowing what that code has to do, i.e. Why would you think that working on eight bits at a time was appropriate when there are obviously two sets of four bits representing the two digits? Why would you think that converting a number to a char was appropriate when the whole point of the exercise is to convert chars to numbers?
0 Comments
Leave a Reply. |