That way, when you are done with the comparisons and tests, you can simply compare the two flags for equality. For example, a byte to hold 0 if the ASCII character is not an alpha character, 1 if the character is uppercase and 2 if the character is lowercase (or whatever consistent scheme you like) Here, and in all cases where a simple state is needed, just using a byte (flag) to store the state is about as simple as anything else. Since two characters are involved, you need a way of saving the case of the first for comparison with the case of the second. Though your question is silent on whether you need to handle both uppercase and lowercase distances, unless you are converting everything to one case or the other, you will need to determine whether both characters are of the same case to make the distance within the alphabet between those two characters valid. ![]() That brings with it a number of checks you must implement. ![]() ![]() If you are still stuck, you question requires that you determine the distance between two characters.
0 Comments
Leave a Reply. |