Schoolans.com

World Class Library Function in Qbasic

In Qbasic there are two types of function Library Function and User Defined Function. Functions provided by QBASIC system are called built-in or Standard or Library function in Qbasic. Library Function is again classified into String Function and Numeric Function. Mid$(), Ltrim$(), Rtrim$() are String function. Len(), INT(), ABS() are Numeric Function.

Here we discuss about the library function in Qbasic and its types. In this section we discuss about Library Function in QBASIC.

Download qbasic Click here.

User Defined FunctionLibrary Function  
-> Defined by the users-> Ready made functions.
Library Function and User Defined Function
Library Functions/in-built function
String FunctionNumeric Function
-> returns string value eg;
i. Left$(StringExp,n)
where n is the end value StringExp = Stringvar or stringvalue  
ii. Right$(StringExp, n)
iii. mid$(StringExp,startVal,endValue)
iv. Str$(X)
-> Converts numeric value to string value
eg; Str$(54) + Str$(55) Output: 54 55
v. CHR$(X)
->Used to represent single character represented by ASCII
eg;  CHR$(65) output : A
vi. LCASE$(A$)
->converts uppercase to lowercase
vii. UCASE$A$)
-> converts lowercase to uppercase
->returns numeric value eg;
i. Len(A$)
->counts number of letters
ii. Int(A)  int(5.3) = 5
->Is used to round off to the integer value
iii. ABS(x)
->Gives the absolute value
iv. SQR(X)
->gives the square root of positive number
v. VAL(x$)
->Converts string number to numeric value
vi. ASC(A$)
->Converts ASCII code of a character
ASC(“B”) => 66
Library Functions/in-built function
CHR$(65) -> AASC(“A”)->65
STR$(55) + “hi” -> 55 hi  VAL(“50”) + 50 -> 100

Use of Numeric Library Function in Qbasic

Library Function in Qbasic

rem using library numeric function

cls
A$ = “Pokhara”
A = 65.7
b$ = “98”
print len(A$)
print val(b$) + 55
print int(a)
print abs(-90)
print sqr(16)
print ASC(“A”)
print str$(54) + “hello”

Try the above program in your computer

REM Using the library string function
cls
A$ = “POKHARA”
B$ = “nepal”
A = 65
Print LEft$(A$,3)
PRint Right$(A$,2)
print mid$(A$,4,5)
print lcase$(A$)
print ucase$(B$)
print str$(a) + str$(90)
print chr$(97)

Try the ab

Library Function in Qbasic

Leave a Comment

Your email address will not be published. Required fields are marked *