The TAB function spaces to position on the screen.
Syntax
LN TAB (n)
Where,
LN : Line Number
n : number of spaces
- Space 1 is the left most position.
- n must be within the range of 1 to 255.
- if the current print position is already beyond space n, TAB goes to that position on the next line.
- TAB should be used with PRINT statement.
Example 2
1. 100 PRINT "NAME" TAB (15); "ADDRESS"; TAB(40); "PHONE NO"
2. 50 PRINT "ROLL NO." TAB(30); "MARKS OBTAINED"
Use of TAB function in the program
CS 5.3 Display on the screen the TAB function
Ok
LIST
5 REM Learning use of TAB function
10 PRINT "NAME" TAB(25) "FEE"
15 PRINT "----" TAB(25) "---"
20 READ A$,B$
30 PRINT A$ TAB(25) B$
40 DATA "SUMA SHAH" , "RS. 500.00"
50 END
Ok
RUN
NAME FEE
---- ---
SUMA SHAH RS. 500.00
Ok
CS 5.4 Display on the screen for TAB statement
Ok
LIST
10 REM Result of First terminal Exam
20 REM of a student
30 PRINT "ENTER NAME, ROLL & MARKS"
40 INPUT "NAME :-"N$
50 INPUT "ROLL NO.:-" R
60 INPUT " MARKS IN ENGLISH" ; E
70 INPUT "MARKS IN NEPALI" ; N
80 INPUT "MARKS IN SCIENCE" ; S
90 INPUT "MARKS IN COMPUTER" ; C
100 PRINT "NAME" ; TAB(30) ; N$
103 PRINT "ROLL NO." ; TAB(30) ; R
106 PRINT
110 PRINT "ENGLISH" ; TAB (30) ; E
120 PRINT "NEPALI" ; TAB(30) ; N
130 PRINT "SCIENCE" ; TAB(30) ; S
140 PRINT "COMPUTER" ;TAB(30) ; C
150 PRINT
160 PRINT "TOTAL" ; TAB(30) ; E+N+S+C
170 END
Ok
No comments:
Post a Comment