To enter a string and count total number of vowels. (Qbasic Code)
Next Method (Using SELECT CASE)
Using SUB Procedure
Using FUNCTION Procedure
- CLS
INPUT "Enter the string"; a$
b$ = LCASE$(a$)
FOR i = 1 TO LEN(b$)
c$ = MID$(b$, i, 1)
IF c$ = "a" OR c$ = "e" OR c$ = "i" OR c$ = "o" OR c$ = "u" THEN
c = c + 1
END IF
NEXT i
PRINT "The number of vowels in the string is "; c
END
Next Method (Using SELECT CASE)
- CLS
INPUT "Enter the string"; a$
b$ = LCASE$(a$)
FOR i = 1 TO LEN(b$)
c$ = MID$(b$, i, 1)
SELECT CASE c$
CASE "a", "e", "i", "o", "u"
c = c + 1
END SELECT
NEXT i
PRINT "The number of vowels in the string is "; c
END
Using SUB Procedure
Using FUNCTION Procedure