В любом слове, введенном с клавиатуры. Определить кол-во букв «а» или «А» — QBasic(Бейсик)

DECLARE FUNCTION CountOfA(s$)
word1$ = ""
word2$ = ""
word3$ = ""
INPUT "Type first word"; word1$
INPUT "Type second word"; word2$
INPUT "Type third word"; word3$
PRINT CountOfA(word1$)
PRINT CountOfA(word2$)
PRINT CountOfA(word3$)
FUNCTION CountOfA(s$)
    CountOfA = 0
    FOR i = 1 TO LEN(s$)
        IF UCASE$(MID$(s$, i, 1)) = "A" THEN CountOfA = CountOfA + 1
    NEXT
END FUNCTION

Leave a Comment