Monday, September 30, 2019

QBASIC PROGRAM TO COUNT TOTAL NO. OF WORDS IN SENTENCE


DECLARE FUNCTION COUNT (S$)
CLS
INPUT "ENTER ANY STRING"; S$
PRINT "TOTAL NO. OF WORDS= "; COUNT(S$)
END

FUNCTION COUNT (S$)
WC = 1
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
IF B$ = " " THEN
WC = WC + 1
END IF
NEXT I
COUNT = WC
END FUNCTION

No comments:

Post a Comment

Experience of COVID-19 and the cancellation of SEE.

As we know, that this pandemic disease has started from the Wuhan district of China. This viruswvirus discovered out on 31st December 2019 ...