Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correcting the code
#2
Code: (Select All)
H$ = "": B$ = ""
While Len(H$) < 7
    Cls
    Locate 1, 1: Print Spc(8);
    Locate 1, 1: Print H$

    B$ = ""
    While B$ = ""
        B$ = InKey$
        _Limit 30
    Wend
    If B$ = Chr$(27) Then End
    If B$ = "-" Then
        If H$ = "" Then H$ = "-" Else Beep
    End If
    If InStr("0123456789", B$) Then H$ = H$ + B$
    If B$ = Chr$(13) Then Exit While
    _Limit 30
Wend
Cls
H# = Val(H$): Print "H ="; H#

Also might not allow 0 as first digit but shouldn't matter when do Val.

I think this would be a whole lot easier with just Input "Enter your number ";h# then check it. Not sure if you want to allow floating decimal? h might be better as long integer as H!
b = b + ...
Reply


Messages In This Thread
Correcting the code - by Chris - 10-27-2023, 07:19 PM
RE: Correcting the code - by bplus - 10-27-2023, 08:28 PM
RE: Correcting the code - by SMcNeill - 10-27-2023, 09:31 PM
RE: Correcting the code - by Chris - 10-28-2023, 06:34 AM
RE: Correcting the code - by SMcNeill - 10-28-2023, 01:46 PM
RE: Correcting the code - by Stuart - 10-28-2023, 10:43 AM
RE: Correcting the code - by Chris - 10-28-2023, 11:34 AM
RE: Correcting the code - by Chris - 10-28-2023, 11:49 AM
RE: Correcting the code - by bplus - 10-28-2023, 12:55 PM
RE: Correcting the code - by Chris - 10-28-2023, 02:13 PM
RE: Correcting the code - by bplus - 10-28-2023, 02:46 PM
RE: Correcting the code - by SMcNeill - 10-28-2023, 06:18 PM
RE: Correcting the code - by Chris - 10-28-2023, 07:44 PM
RE: Correcting the code - by bplus - 10-28-2023, 07:47 PM
RE: Correcting the code - by SMcNeill - 10-28-2023, 09:48 PM
RE: Correcting the code - by bplus - 10-28-2023, 07:51 PM



Users browsing this thread: 4 Guest(s)