home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
pcresorc
/
pcr815.arc
/
WORDCT.BAS
< prev
Wrap
BASIC Source File
|
1988-08-04
|
591b
|
21 lines
10 REM WORDCT, a program to count words in a text file
20 DIM A$(1500)
30 CLS
40 INPUT "Name of text file: ",F$
50 OPEN F$ FOR INPUT AS 1
60 LOCATE 10,30: PRINT "LOADING THE TEXTFILE"
70 IF EOF(1) THEN 110
80 Q = Q + 1
90 INPUT #1, A$(Q)
100 GOTO 70
110 CLOSE 1
120 CLS: LOCATE 10,36: PRINT "COUNTING"
130 FOR I = 1 TO Q
140 IF LEN(A$(I)) < 1 THEN WDCT = WDCT-1: GOTO 180
150 FOR J=1 TO LEN(A$(I))
160 IF MID$(A$(I),J,1) = " " AND MID$(A$(I),J,2)
<> " " THEN WDCT = WDCT + 1
170 NEXT J
180 NEXT I
190 CLS: PRINT F$;" contains";WDCT + Q;"words"