'Ŀ ' ' Program : Missing Numbers - for Steffi ' ' ' Language : QuickBasic 4.5 ' Programmed : October 13, 2007 ' ' ' '============================ Main program ================================ CLS CLEAR DEFLNG A-Z GOSUB PrintInfo ' Display the purpose of the program GOSUB GetObjectNumber ' Ask for the number of objects GOSUB CheckRange ' Make sure the number is within the valid range GOSUB GetReadableDigits ' Ask for the three readable middle digits GOSUB ComposeStartnum ' Compose the start number GOSUB CheckNumbers ' Check if all possible numbers are mod 0 divisible by ObjectNumber GOSUB DaCapo ' One more time? END '============================ Subroutines ================================= PrintInfo: PRINT PRINT "Ŀ" PRINT " Dieses Programm ermittelt die nicht lesbaren Ziffern eines Rechnungs- " PRINT " betrages fr n Objekte (1 99 THEN PRINT PRINT "Die Zahl der Objekte muss zwischen 1 und 99 liegen." PRINT PRINT "Bitte Taste drcken und neu eingeben ..." GOSUB WaitForKey RUN END IF RETURN GetReadableDigits: INPUT "Lesbare Ziffern ohne Komma (?xx,x?)"; readable$ 'for the sake of simplicity RETURN 'omit the decimal point. ComposeStartnum: Startnumber = VAL("1" + readable$ + "0") RETURN CheckNumbers: Checknumber = Startnumber IF Checknumber MOD ObjectNumber = 0 THEN PRINT Checknumber; "geteilt durch"; ObjectNumber; "ist"; (Checknumber / ObjectNumber) END IF FOR m = 1 TO 9 FOR n = 1 TO 9 Checknumber = Checknumber + 1 IF Checknumber MOD ObjectNumber = 0 THEN PRINT Checknumber; "geteilt durch"; ObjectNumber; "ist"; (Checknumber / ObjectNumber) END IF NEXT n IF Checknumber < 90000 THEN Checknumber = Checknumber + 9991 END IF IF Checknumber MOD ObjectNumber = 0 THEN PRINT Checknumber; "geteilt durch"; ObjectNumber; "ist"; (Checknumber / ObjectNumber) END IF NEXT m PRINT RETURN DaCapo: PRINT "Nochmal (y/N)? "; GOSUB WaitForKey IF UCASE$(KeyHit$) = "Y" THEN RUN RETURN WaitForKey: KeyHit$ = "" WHILE KeyHit$ = "" KeyHit$ = INKEY$ WEND RETURN