Posted by: Sourav | December 6, 2013

Some string operations in QBasic


CLS DIM word AS STRING

PRINT LEN(“Hello”)

PRINT MID$(“Hello”, 1, 1)

PRINT MID$(“Hello”, 1, 2)

PRINT MID$(“Hello”, 4, 2)

LOCATE 12, 20

PRINT “hello”

INPUT “enter word: “, word

FOR x = 1 TO LEN(word)    

PRINT MID$(word, x, 1)

NEXT x

INPUT “enter word: “, word

FOR x = LEN(word) TO 1 STEP -1   

  PRINT MID$(word, x, 1)

NEXT x

 

INPUT “enter word: “, word

FOR x = 1 TO LEN(word)

    LOCATE x + 10, x + 10

    PRINT MID$(word, x, 1) NEXT x

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: