Correcting the code - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: Correcting the code (/showthread.php?tid=2122) Pages:
1
2
|
RE: Correcting the code - bplus - 10-28-2023 Quote: SMcNeill Good thing I already have the whole thing fixed, reply #8! https://qb64phoenix.com/forum/showthread.php?tid=2122&pid=21010#pid21010 Don't know why above link fails continuously??? @Chris I repeat post #8 Code: (Select All) H$ = "": B$ = "" RE: Correcting the code - SMcNeill - 10-28-2023 Code: (Select All)
So here's a question: What happens if someone hits 00123? Does that count as 123? Is it valid? Or is it 0? Is the 0 *only* valid when by itself? Or can it be preceeding other numbers? What you're wanting isn't hard to do. Figuring out the RULES of what's acceptable and what isn't, is what's hard to account for in this case. LOL! What happens with? 0<enter> --- this is 0. Correct? 00123<enter> -- is this valid, or should that 123 automatically erase those leading zeros to make 123? Or should it stay 00123? 0123456 -- does this count as a 7 digit value? Or should this be 6, with that zero not possible? RE: Correcting the code - Chris - 10-28-2023 For example: N# <= calculated before the loop 0000050 ENTER => 50 000050 ENTER => 50 00050 ENTER => 50 0050 ENTER => 50 050 ENTER => 50 50 ENTER => 50 0000000 ENTER => 0 000000 ENTER => 0 00000 ENTER => 0 0000 ENTER => 0 000 ENTER => 0 00 ENTER => 0 0 ENTER => 0 0000123 ENTER => 123 000123 ENTER => 123 00123 ENTER => 123 0123 ENTER => 123 123 ENTER => 123 ENTER => N# When the ENTER key is pressed, it is supposed to take the value calculated before the loop. Then H# = N# There is probably also a possibility, which I have not written about before, that if you press the zero (0) key, there will be an automatic exit from the loop. There is no point in entering zeros (0) before significant figures. If someone hits zero (0), you know that nothing will happen further. But this is an additional option. <bplus> is close to solving it but for some unknown reason it doesn't want to finish the job. And I respect that. My code works fine, I just wanted to improve it. If this is a big problem, the topic can be closed. RE: Correcting the code - bplus - 10-28-2023 Quote:2. If I enter numbers in the range 1-999999 and confirm with the Enter key, such values should be included in the H# variable. @SMcneill I like the backspace but what is wrong with 8's and 9's LOL do you think this is octal digits? @Chris and for you sir or mam, # is the double type for floating point numbers you might like ! for long integer types, maybe even ~! to exclude negative numbers? RE: Correcting the code - bplus - 10-28-2023 Quote:<bplus> is close to solving it but for some unknown reason it doesn't want to finish the job. And I respect that. Are you talking about Stuart's faulty mod of my code or are you talking about my reply #8 which I think not only finishes the job but also allows negative numbers PLUS uses the proper Type for Integers AND does it all under one IF Block of code (though it did not do backspace which it should). RE: Correcting the code - SMcNeill - 10-28-2023 (10-28-2023, 07:47 PM)bplus Wrote:Quote:2. If I enter numbers in the range 1-999999 and confirm with the Enter key, such values should be included in the H# variable. But if the entered number is 1,2,3,4,5,6 digits, it is to be confirmed with the Enter key. However, the 7-digit number is to be approved automatically. To sum up, the entered numbers may have the following values: 0, 11, 232, 1254, 36547, 325478, 3254657. I dunno. Reading the above, there was massive talk of 1, 2, 3, 4, 5, 6, and 7, and then my eyes skipped over the 8 in the 325478 example, so yeah... I was kinda working off an octal-base. LOL! Change the SELECT CASE from "0" TO "7", to "0" TO "9", and it should be okay to go. That's a simple enough debig that anyone should be able to catch/fix it. Too many long nights here, with eyes blurring over ancient, esoteric code from the 1970s for me in this last week. My comprehension seems to be only about 30% of normal right now. I needs massive sleeps and even more massive coffees after, to get back on track! LOL! |