In QBasic, the CLS
statement stands for "Clear Screen." It is used to clear the current screen of any text or graphics, providing a clean slate for subsequent output. When CLS
is executed, all visible content is removed, allowing programmers to refresh the display during a program's execution. This is particularly useful for improving readability and organizing output in console applications.
QBASIC CODE/START... ==== ...QBASIC CODE/END.
strText$ = "Some text to be underlined." CLS PRINT strText$ PRINT STRING$(LEN(strText$), "*")
cls a =1 for i = 1 to 5 print a; a = (a*10)+1 next i end
REMPATTERNS (not necessary) CLS FOR I = 1 TO 5 STEP +1 FOR J = 1 TO I STEP+1 PRINT J NEXT J PRINT NEXT I END Hope you find this helpful :)
10 cls 11 c = 0 20 for n =1 to 10 30 input"enter no.";a 40 c=c+a 50 next n 60 print c
CLS FOR eachNum%=1 TO 10 STEP 2 PRINT eachNum% NEXT
QBASIC CODE/START... ==== ...QBASIC CODE/END.
PRINT "What is your name ?" INPUT NAM$ CLS FOR N = 1 TO 10 PRINT NAM$ NEXT N
strText$ = "Some text to be underlined." CLS PRINT strText$ PRINT STRING$(LEN(strText$), "*")
with line statement, we can also draw boxes. SCREEN 7 COLOUR 5, 15 CLS LINE(60,60)-(130,100),6,B the letter B indicates the box option
cls input "enter a name"; a$ b=1 while b <=1 print a$ b = b+1 wend end
cls a =1 for i = 1 to 5 print a; a = (a*10)+1 next i end
REMPATTERNS (not necessary) CLS FOR I = 1 TO 5 STEP +1 FOR J = 1 TO I STEP+1 PRINT J NEXT J PRINT NEXT I END Hope you find this helpful :)
10 cls 11 c = 0 20 for n =1 to 10 30 input"enter no.";a 40 c=c+a 50 next n 60 print c
the extensions of qbasic are that, there are only 80 pixels to write in the qbasic
There are multiple ways to generate that particular string, several more than can be listed in one answer. For example: CLS PRINT "1 3 5" or CLS REM An easy "1 through 5, odds only" FOR loop. FOR X = 1 TO 5 STEP 2 PRINT X; NEXT X or even CLS INPUT "Please type in a number series with no line breaks (spaces okay):", numbers$ PRINT numbers$
CLS a = 0 b = 0 FOR i = 1 TO 10 IF a = 0 THEN f = 1 END IF PRINT f b = a a = f f = a + b NEXT i END from : Parth jani parthjani7@yahoo.com