'=========================================================================== ' Subject: FREQUENCY ANALYSIS PROGRAM Date: 02-14-98 (15:03) ' Author: Bert van Dam Code: QB, QBasic, PDS ' Origin: bd1rsd@usa.net Packet: ALGOR.ABC '=========================================================================== 'Frequency analyses program by Bert van Dam, 1998. You can 'contact me at BD1RSD@USA.NET of in the Fido QUIK_BAS echo. 'This program is donated to the public domain. 'If you use creativity when filling in your tax forms you have a 'natural tendency to like some numbers more than others. You may 'for example be more inclined to use a 3 than a 5, without 'knowing it. This tendency helps the tax office to spot your 'creativity, and result in more attantion to your data than you 'might like. 'This programs makes a statistical analyses of all numbers (and 'letters if you like) in a document file. First make an analyses 'of your untampered previous files to get the normal distribution 'for your line of business (for example in a grocery shop price 'list the numbers 9 and 5 naturally occur more often, as in prices 'such as 19.95). Then perform the same analyses on a tampered 'file. If you see any differences your taxform needs some more 'work.... DIM soort(125) kat = 0 CLS PRINT " FREQUENCY ANALYSES PROGRAM OF ASCII FILES" PRINT LOCATE 9, 1 PRINT "Enter path and file name, for example c:\data\freq.doc" LINE INPUT ""; bestand$ letter$ = STRING$(1, " ") PRINT : PRINT PRINT "Evaluate numbers (C) or include letters (L) "; kat$ = INPUT$(1) IF INSTR(kat$, "c") <> 0 OR INSTR(kat$, "C") <> 0 THEN kat = 1 OPEN bestand$ FOR BINARY AS #1 wacht = 25 soort = 0 filegemaakt = 0 DO UNTIL EOF(1) nummer = nummer + 1 LOCATE 20, 20 PRINT "Reading character "; nummer GET #1, , letter$ FOR counter = 1 TO 3 IF counter = 1 THEN start = 48 einde = 57 END IF IF kat <> 1 AND counter = 2 THEN start = 65 einde = 90 END IF IF kat <> 1 AND counter = 3 THEN start = 97 einde = 122 END IF FOR teller = start TO einde IF letter$ = CHR$(teller) THEN soort(teller) = soort(teller) + 1 totaal = totaal + 1 END IF NEXT teller IF kat = 1 THEN counter = 4 NEXT counter LOOP CLOSE #1 CLOSE #2 CLS PRINT " FREQUENCY ANALYSES PROGRAM OF ASCII FILES" spatie = 1 regel = 1 FOR counter = 1 TO 3 IF counter = 1 THEN start = 48 einde = 57 END IF IF kat <> 1 AND counter = 2 THEN start = 65 einde = 90 END IF IF kat <> 1 AND counter = 3 THEN start = 97 einde = 122 END IF FOR teller = start TO einde regel = regel + 1 LOCATE regel, spatie PRINT "Char. "; CHR$(teller); soort(teller) = (soort(teller) / totaal) * 100 PRINT " freq. "; PRINT USING "###"; soort(teller); PRINT " %." IF regel = 22 THEN regel = 1 spatie = spatie + 25 END IF NEXT teller IF kat = 1 THEN counter = 4 NEXT counter END