Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Monday, November 28, 2022

QBASIC program to display the consonant letters from the input string

QBASIC program to display the consonant letters from the input string



CLS

INPUT "Enter any string"; a$

FOR i = 1 TO LEN(a$)

m$ = UCASE$(MID$(a$, i, 1))

SELECT CASE m$

CASE "A", "E", "I", "O", "U"

v = 1

CASE ELSE

PRINT m$;

END SELECT

NEXT i

END

 

Using SUB procedure (SUB…END SUB)

DECLARE SUB cons (a$)

CLS

INPUT "Enter any string"; a$

CALL cons(a$)

END

 

SUB cons (a$)

FOR i = 1 TO LEN(a$)

m$ = UCASE$(MID$(a$, i, 1))

IF m$ = "A" OR m$ = "E" OR m$ = "I" OR m$ = "O" OR m$ = "U" THEN

v = 1

ELSE

PRINT m$;

END IF

NEXT i

END SUB

 

Using FUNCTION procedure (FUNCTION…END FUNCTION)

DECLARE FUNCTION vowel$ (a$)

CLS

INPUT "Enter any string:"; a$

PRINT vowel$(a$)

END

 

FUNCTION vowel$ (a$)

FOR i = 1 TO LEN(a$)

m$ = UCASE$(MID$(a$, i, 1))

SELECT CASE m$

CASE "A", "E", "I", "O", "U"

v$ = v$ + m$

END SELECT

NEXT i

vowel$ = v$

END FUNCTION 

Output:



No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages