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

Wednesday, February 16, 2022

Library Functions in QBASIC

 

Library Functions in QBASIC


Library Functions in QBASIC



Introduction

QBASIC is an integrated development environment (IDE) and programming language that was developed by Microsoft in the 1980s. It is a variant of the BASIC programming language and is still used today by hobbyists and professionals alike. One of the most significant features of QBASIC is its extensive library of built-in functions. These library functions provide programmers with a range of powerful tools that can be used to perform a variety of tasks. In this blog post, we will explore the concept of library functions in QBASIC and how they can be used to enhance the functionality of programs.


Following are the functions of QBASIC:

i) User defined function
ii) Library / Built in function.




i) User Defined Functions

A function which can be define by the user to perform the specific task is known as user define function FUNCTION………END FUNCTION, DEF FN statement can be used to define the function.


ii) Library/Built in functions

The functions which are already stored in QBASIC are known as library functions. Some common Build-IN or Library Functions are LEN, LEFT$, RIGHT$, MID$, UCASE$, LCASE$, CHR$……..etc.

 


Library Functions in QBASIC:

QBASIC comes with a vast library of built-in functions that provide programmers with a range of tools that can be used to perform a variety of tasks. These library functions can be categorized into several groups, including math functions, string functions, file handling functions, and date and time functions.

Types of Library functions

A library function can be categorized according to the type value return by the function. Types of library functions are as here under.

i) Numeric / Mathematical Functions
ii) String Functions
iii) File handling functions
iv) Date and Time functions

 

Numeric / Mathematical Functions

Numeric functions are work with numeric data. Some of the numeric functions are ABS, INT, SGN, SIN, COS, TAN, CINT etc.

 


String Functions

The functions which works with characters or alphanumeric character which are enclosed within a double quotation marks. Some examples of the string functions are LEFT$, RIGHT$, MID$, LEN, LCASE$, UCASE$ etc.


File Handling Functions:

QBASIC provides a range of functions that can be used to perform file handling operations. These include functions for opening, reading, writing, and closing files, as well as functions for working with directories and file attributes.

Date and Time Functions:

QBASIC provides programmers with a range of functions that can be used to work with dates and times. These include functions for getting the current date and time, converting dates and times to different formats, and performing date and time calculations.



Calling a function

When a function is used in the program and returns a value, then it is called calling a function. To use function in the program, we need to use the name of the function with the list of arguments to be passed to the function. The arguments are the constant or variable that is passed to the function for performing a specific task. The arguments are kept inside the parenthesis ( ). When the data or arguments are written inside the parenthesis along with function name, it is called passing arguments. A function can be called from any of the following methods.

i) By using PRINT statement

ii) By using Variable

 


By using PRINT statement

By using PRINT statement we can call the function in QBASIC. It displays the return value when we used the PRINT statement.


By using Variable

With the help of variable name we can return the value. The variable and return value should be matched.


 Example:

By using PRINT statement

By using Variable

PRINT LEN(“QBASIC”)

 

Note: It displays the return value 5 directly.

LET a$=”QBASIC

S=LEN(a$)

Note: It stores the return value 5 in the variable s.



Conclusion:

In conclusion, library functions in QBASIC provide programmers with a range of powerful tools that can be used to enhance the functionality of programs. These functions provide a convenient and efficient way to perform a variety of tasks, from basic arithmetic calculations to more complex file handling and date and time operations. By mastering the use of library functions in QBASIC, programmers can create more powerful and efficient programs, making QBASIC a versatile and useful programming language for a wide range of applications.


Also Read: 




No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages