SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
Hello! & Namaste
I am Roshan Maharjan
I am here because I love to give
presentations.
You can find me at
@https://slideshare.net/RoshanMaharjan13
@fsscomputer2020@gmail.com
1
Basics of QBASIC
By: Roshan Maharjan
OUTLINES
➢ Identify the special features of QBASIC.
➢ Explain the elements of QBASIC programming.
➢ Identify the various methods of declaring
variables.
➢ Explain the importance of QBASIC syntax.
3
“Our greatest weakness lies in giving up.
The most certain way to succeed is
always to try just one more time.” –
Thomas A. Edison
4
QBASIC
Quick Beginner’s All-Purpose
Symbolic Instruction Code
1
5
Introduction
▪ QBasic is a simple programming language developed by
Microsoft to type, edit, debug and execute BASIC programs.
▪ A QBasic program consists of various elements. They are
a character set, constants, variables, statements, operators
and expressions.
▪ A QBasic statement is a command or set of instructions to
perform a certain task.
▪ BASIC is an interpreter which means it reads every line,
translate it and lets the computer execute it before reading
another.
▪ Each instruction starts with a line number.
6
Features
▪ It is simple and easy to learn.
▪ It is an interpreter having its own editor.
▪ It has dynamic program debugging
▪ It supports the local and global variable.
▪ It supports modular programming.
▪ It capitalizes the reserved words automatically.
▪ The syntaxes of the statements are checked automatically
7
Starting
with
QBASIC
8
This is the Program Area
Immediate Window
Starting QBASIC
▪ QBASIC may not be on your computer.
▪ At first, you need to have QBASIC in your computer.
▪ It is freely available. You can download it from the
Internet as well..
QBASIC Interface
9
Components of Qbasic
Menu Bar
It Consists of a
list of menus
like file, edit,
view, search,
Run, options
and help.
Program Window
The upper window
tittles “untitled” is
the window where
you write the
complete program.
F5 key is pressed to
execute or run the
program to get the
result.
Immediate Window
The lower window is
titled immediate
window where the
simple statements are
typed which get
executed immediately.
Errors are displayed
here.
10
Status Bar
It shows
shortcut keys
and location
of the cursor
on the screen.
File Menu Options
11
File Menu
New Clears the current program.
Open Loads a program from the desk.
Save Saves the current program to disk.
Save As
Saves the program, but under a different
name.
Print
Prints the selected text, current window,
or entire program.
Exit Closes the QBASIC interpreter.
Edit Menu Options
12
Edit Menu
Cut
Removes the selected text and stores it in the
clipboard.
Copy
Copies the selected text instead of removing
it.
Paste
Adds the text in the clipboard to the current
position of the cursor.
Clear
Removes the text without storing it on the
clipboard.
New Sub Enables you to create a new subroutine
New Function Enables you to create a new function
View Menu Options
13
View Menu
SUBs
Shows the list of current subroutines and
functions.
Split
Displays the contents of the current program
in two windows. If the window is already split,
this hides the second window.
Output
Screen
Shows the Qbasic output screen
Search Menu Options
14
Search Menu
Find
Allow you to search for a string of text in
the program
Repeat Last
Find
Continues the previous search operation
Change
Replaces each instance of a string with
another string
Run Menu Options
15
Run Menu
Start
Allow you to search for a string of text in the
program
Restart Continues the previous search operation
Continue
Replaces each instance of a string with
another string
Debug Menu Options
16
Debug Menu
Step Processes the next command
Procedure
Step
Processes the next command, does not show
Qbasic going inside a subroutine or function.
Trace On
Shows the command that is being executed
while the program is running.
Toggle
Breakpoint
Sets or removes a breakpoint.
Set Next
Statement
Allows you to continue execution at the
special line
Help Menu Options
17
Help Menu
Index
To display the help index by listing all the
commands, keywords, operators, etc
Contents To display the help table of content
Topic
To display information on a topic determined
by the current location of the cursor.
Using Help Displays information on using QBASIC help.
About
Shows information about the QBASIC
interpreter
▪ Character Sets
▪ Keywords
▪ Variable
▪ Constants
▪ Operators, expressions and operand
▪ Program statements
18
Elements of QBASIC
Character set is a set of valid characters that a language can
recognize.
A character represents any letter, digit, or any other sign.
The QBASIC has the following character sets:
▪ Alphabets A, B.. Z, a, b, c,.....z.
▪ Number 0-9.
▪ Special symbols like ;,=, +,-,/,*,( ),%, $, #, &, ?,<, >etc.
Character Set
19
▪ Keywords are the words that convey a special
meaning to the language.
▪ These are reserved for special purpose and must not
be used as normal identifier names.
▪ Some of the QBASIC keywords are: REM, CLS, INPUT,
LET, PRINT and END
Keywords
(Reserved Words)
20
🔑
Variable
21
▪ Variables are the memory locations in the computer’s
memory for storing data.
▪ They provide an “interface” to RAM.
▪ They are the containers that holds the information.
▪ Their sole purpose is to label and store the data in
memory so that can be used throughout the program.
The variable names have the following properties:
22
Continue……
Variable - Naming Conventions
▪ Any Variable name may be up to 40 characters long.
▪ Variable names must begin with a letter ( A…Z, a…z ).
▪ Cannot contain characters other than letters, numbers, period, and the type declaration
characters ($, %, #, &, and ! ).
▪ Cannot be a reserved words, although embedded reserved words are allowed.
▪ Variable may represent either numeric values or string.
▪ Cannot begin with “FN” unless it is a function call.
Variables occur in two distinct types i.e. numeric variable and string variable depending
upon data item they represent.
23
Continue……
Types of variables
▪ Numeric Variable
• Numeric variables store numeric data.
• It’s name can be formed by letters and digits.
• It should however always begin with an alphabet and should not contain any
special characters or spaces.
• For example, (i) age = 30 (ii) mark1 = 73.6. Here age is a numeric variable which
stores the constant value 30.
• Numeric variables may be declared as:
24
Continue……
Numeric Variable
▪ Integers
• Integer variable is declared by using a percent sign (%) as the last character of the
variable name
• They are stored as 2 bytes ranging in value from -32768 to +32767.
• The declaration of a variable as an integer causes the variable’s value to be rounded
to the closest integer.
• For example: A% = 50
• They accept only non-decimal values i.e real values
25
Continue……
Numeric Variable
▪ Long Integers
• Long Integer variable is declared by using a ampersand sign (&) as the last
character of the variable name.
• They are stored as 4 bytes ranging in value from -2,147,483,648 to + 2,147,483,648
• For example: A& = 5023456
26
Continue……
Numeric Variable
▪ Single Precision
• Single Precision variable is declared by using a exclamation sign (!) as the last
character of the variable name
• They are stored as 2 bytes ranging in value from -3.37 x 10^38 to + 3.3 x 10^38.
• The declaration of a variable as single precision and exceeds seven digits is rounded
to its closest value.
• Although the seventh digit is displayed, its accuracy is not dependable.
• For example: A! = 123.4567
27
Continue……
Numeric Variable
▪ Double Precision
• Double Precision variable is declared by using a Hash sign (#) as the last character of
the variable name
• They are stored as 4 bytes ranging in value from -1.67 x 10^308 to + 1.67 x 10^308.
• The declaration of a variable as double precision and exceeds 16 digits is rounded to
its closest value.
• For example: Count# = 123.4567
28
String Variable
▪ String variables represents numbers, alphabets, and special characters.
▪ This variable should:
• begin with an alphabet.
• end with dollar sign($).
• be of more than one characters and numbers but no special characters
are allowed
▪ Data are stored inside double quotation.
▪ Example: A$ = “Hello world”
29
Constant
▪ Constant is a value stored in a program which does not change during program
execution.
▪ Based on the type of data, it is classified into two types:
• Numeric Constant
• Numeric constant is a numeric value on which mathematical operations
such as addition, subtraction, multiplication and division can be
performed.
• It consists of sequence of digits (0-9) with or without decimal point.
• It can be a positive or negative numbers.
• Example: 17, -54, 23.5, -7.5.
30
Continue……
Constant
• String constant is a set of alphanumeric or special characters enclosed within
double quotes.
• Blank spaces can also be used in a string.
• These type of data cannot be used for mathematical calculations but can be used for
comparisons and references.
• For example: “Computer Science”, “Fluorescent”
• String Constant
• Symbolic Constant
• Symbolic constant is used when a value is not expected to change during the
execution of the program.
• The CONST statement is a non-executable statement that declares symbolic
constants.
• For example: CONST PI = 22/7
31
Operator and Expression
▪ An operator is a symbol representing the operations they perform on
operands in a program.
▪ The value on which the operators work are referred to as operands.
▪ An expression is a programming statements that has a value.
▪ It is composed of operators and operands.
▪ Operators perform mathematical or logical operations on values
▪ Types of Operators.
• Arithmetic operators.
• Relational operators.
• Logical operators.
• String operators.
Arithmetic operators
32
▪ Arithmetic operators performs arithmetic operations on the numeric
values or on the variables holding numeric values.
▪ An expression formed with arithmetic operators is termed as arithmetic
expressions.
Operators Operations Example Result
^ Exponential X = 2 ^3 X = 8
- Negation x = -y X = -(9-3) X = - 6
* Multiplication X = 3 *3 X = 9
/ Floating-point Division X = 5/2 X = 2.5
 Integer Division X = 52 X = 2
MOD Modulus Division X = 5 MOD 2 X = 1
+ Addition X = 3 + 4 X = 7
- Subtraction X = 6 – 3 X = 3
Relational operators
33
▪ Relational operators are used to evaluate and compare two values of the
same type, either both numeric or both string.
▪ The result of comparison is either TRUE or FALSE.
Operators Operations Example Result
= Equal 6 = 5 False
< Less than 6<5 False
>
Greater than 6>5
5>6
True
False
<=
Less than or equal to 6<=5
5<=6
False
True
>=
Greater than or equal to 6>=5
5>=6
True
False
<> Not equal to 6<>5 True
Logical operators
34
▪ Logical operators are used to connect two or more relational expressions
to evaluate a single value as True or False.
▪ The logical operators supported by QBASIC are:
▪ AND operator
• When two logical expressions are combined using AND logical
operator, the entire logic operation will be TRUE only if both the
logical expressions are individually TRUE.
▪ OR operator
• The entire logic operation in this case will be TRUE if either of
the logical expression is TRUE.
▪ NOT operator
• Not is a negative check operator. It operates with one operand
• It is used to reverse the logical state of its operand. If a
condition is true, then Logical NOT operator will make it false.
Logical operators
35
▪ Truth Table
Value (A) Value (B) A AND B A OR B NOT A
F F F F T
F T F T T
T F F T F
T T T T F
36
Concatenation Operator
▪ An expression involving string variables and constants is called string
expression.
▪ Concatenation operators connect multiple strings into a single string.
▪ QBASIC use the plus sign (+) as a string concatenation operator.
▪ QBASIC use the plus sign (+) as a string concatenation operator.
THANKS!
Any questions?
You can find me at
@https://www.slideshare.net/RoshanMaharjan13
& fsscomputer2020@gmail.com
37

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Introduction to system programming
Introduction to system programmingIntroduction to system programming
Introduction to system programming
 
Strings in C
Strings in CStrings in C
Strings in C
 
Programming
ProgrammingProgramming
Programming
 
Data types in C language
Data types in C languageData types in C language
Data types in C language
 
Qbasic Tutorial
Qbasic TutorialQbasic Tutorial
Qbasic Tutorial
 
Qbasic introduction
Qbasic introductionQbasic introduction
Qbasic introduction
 
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Presentation on generation of languages
Presentation on generation of languagesPresentation on generation of languages
Presentation on generation of languages
 
Types of software
Types of softwareTypes of software
Types of software
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Operating system basics
Operating system basicsOperating system basics
Operating system basics
 
Computer keyboard
Computer keyboardComputer keyboard
Computer keyboard
 
Introduction to loops
Introduction to loopsIntroduction to loops
Introduction to loops
 
C basics
C   basicsC   basics
C basics
 
Interpreter
InterpreterInterpreter
Interpreter
 
C program
C programC program
C program
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Programming : QBASIC
Programming : QBASICProgramming : QBASIC
Programming : QBASIC
 
Computer Memory
 Computer Memory Computer Memory
Computer Memory
 

Ähnlich wie Basic of qbasic

Qbesic programming class 9
Qbesic programming class 9Qbesic programming class 9
Qbesic programming class 9bhuwanbist1
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_languageSINGH PROJECTS
 
Programming fundamental 02.pptx
Programming fundamental 02.pptxProgramming fundamental 02.pptx
Programming fundamental 02.pptxZubairAli256321
 
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdfL2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdfMMRF2
 
CSC111-Chap_02.pdf
CSC111-Chap_02.pdfCSC111-Chap_02.pdf
CSC111-Chap_02.pdf2b75fd3051
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
Basic of the C language
Basic of the C languageBasic of the C language
Basic of the C languageSachin Verma
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageZubayer Farazi
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckseidounsemel
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
 

Ähnlich wie Basic of qbasic (20)

Qbesic programming class 9
Qbesic programming class 9Qbesic programming class 9
Qbesic programming class 9
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
Basic concept of c++
Basic concept of c++Basic concept of c++
Basic concept of c++
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
 
c-programming
c-programmingc-programming
c-programming
 
Programming fundamental 02.pptx
Programming fundamental 02.pptxProgramming fundamental 02.pptx
Programming fundamental 02.pptx
 
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdfL2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
L2 C# Programming Comments, Keywords, Identifiers, Variables.pdf
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 
CSC111-Chap_02.pdf
CSC111-Chap_02.pdfCSC111-Chap_02.pdf
CSC111-Chap_02.pdf
 
C PADHLO FRANDS.pdf
C PADHLO FRANDS.pdfC PADHLO FRANDS.pdf
C PADHLO FRANDS.pdf
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
 
C programming language
C programming languageC programming language
C programming language
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Basic of the C language
Basic of the C languageBasic of the C language
Basic of the C language
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
Lamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ckLamborghini Veneno Allegheri #2004@f**ck
Lamborghini Veneno Allegheri #2004@f**ck
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 

Mehr von RoshanMaharjan13 (14)

E-Commerce.pptx
E-Commerce.pptxE-Commerce.pptx
E-Commerce.pptx
 
Computer security
Computer securityComputer security
Computer security
 
File handling
File handlingFile handling
File handling
 
Ethical and Social Issues in ICT
Ethical and Social Issues in ICTEthical and Social Issues in ICT
Ethical and Social Issues in ICT
 
Ms access
Ms accessMs access
Ms access
 
Ms access
Ms accessMs access
Ms access
 
Computer Software
Computer SoftwareComputer Software
Computer Software
 
Number system
Number systemNumber system
Number system
 
Computer hardware
Computer hardwareComputer hardware
Computer hardware
 
Networking and telecommunication
Networking and telecommunication Networking and telecommunication
Networking and telecommunication
 
Categories of computer
Categories of computerCategories of computer
Categories of computer
 
Microsoft word
Microsoft wordMicrosoft word
Microsoft word
 
Modular programming
Modular programmingModular programming
Modular programming
 
Introduction to computer
Introduction to computerIntroduction to computer
Introduction to computer
 

Kürzlich hochgeladen

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 

Kürzlich hochgeladen (20)

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 

Basic of qbasic

  • 1. Hello! & Namaste I am Roshan Maharjan I am here because I love to give presentations. You can find me at @https://slideshare.net/RoshanMaharjan13 @fsscomputer2020@gmail.com 1
  • 2. Basics of QBASIC By: Roshan Maharjan
  • 3. OUTLINES ➢ Identify the special features of QBASIC. ➢ Explain the elements of QBASIC programming. ➢ Identify the various methods of declaring variables. ➢ Explain the importance of QBASIC syntax. 3
  • 4. “Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.” – Thomas A. Edison 4
  • 6. Introduction ▪ QBasic is a simple programming language developed by Microsoft to type, edit, debug and execute BASIC programs. ▪ A QBasic program consists of various elements. They are a character set, constants, variables, statements, operators and expressions. ▪ A QBasic statement is a command or set of instructions to perform a certain task. ▪ BASIC is an interpreter which means it reads every line, translate it and lets the computer execute it before reading another. ▪ Each instruction starts with a line number. 6
  • 7. Features ▪ It is simple and easy to learn. ▪ It is an interpreter having its own editor. ▪ It has dynamic program debugging ▪ It supports the local and global variable. ▪ It supports modular programming. ▪ It capitalizes the reserved words automatically. ▪ The syntaxes of the statements are checked automatically 7
  • 8. Starting with QBASIC 8 This is the Program Area Immediate Window
  • 9. Starting QBASIC ▪ QBASIC may not be on your computer. ▪ At first, you need to have QBASIC in your computer. ▪ It is freely available. You can download it from the Internet as well.. QBASIC Interface 9
  • 10. Components of Qbasic Menu Bar It Consists of a list of menus like file, edit, view, search, Run, options and help. Program Window The upper window tittles “untitled” is the window where you write the complete program. F5 key is pressed to execute or run the program to get the result. Immediate Window The lower window is titled immediate window where the simple statements are typed which get executed immediately. Errors are displayed here. 10 Status Bar It shows shortcut keys and location of the cursor on the screen.
  • 11. File Menu Options 11 File Menu New Clears the current program. Open Loads a program from the desk. Save Saves the current program to disk. Save As Saves the program, but under a different name. Print Prints the selected text, current window, or entire program. Exit Closes the QBASIC interpreter.
  • 12. Edit Menu Options 12 Edit Menu Cut Removes the selected text and stores it in the clipboard. Copy Copies the selected text instead of removing it. Paste Adds the text in the clipboard to the current position of the cursor. Clear Removes the text without storing it on the clipboard. New Sub Enables you to create a new subroutine New Function Enables you to create a new function
  • 13. View Menu Options 13 View Menu SUBs Shows the list of current subroutines and functions. Split Displays the contents of the current program in two windows. If the window is already split, this hides the second window. Output Screen Shows the Qbasic output screen
  • 14. Search Menu Options 14 Search Menu Find Allow you to search for a string of text in the program Repeat Last Find Continues the previous search operation Change Replaces each instance of a string with another string
  • 15. Run Menu Options 15 Run Menu Start Allow you to search for a string of text in the program Restart Continues the previous search operation Continue Replaces each instance of a string with another string
  • 16. Debug Menu Options 16 Debug Menu Step Processes the next command Procedure Step Processes the next command, does not show Qbasic going inside a subroutine or function. Trace On Shows the command that is being executed while the program is running. Toggle Breakpoint Sets or removes a breakpoint. Set Next Statement Allows you to continue execution at the special line
  • 17. Help Menu Options 17 Help Menu Index To display the help index by listing all the commands, keywords, operators, etc Contents To display the help table of content Topic To display information on a topic determined by the current location of the cursor. Using Help Displays information on using QBASIC help. About Shows information about the QBASIC interpreter
  • 18. ▪ Character Sets ▪ Keywords ▪ Variable ▪ Constants ▪ Operators, expressions and operand ▪ Program statements 18 Elements of QBASIC
  • 19. Character set is a set of valid characters that a language can recognize. A character represents any letter, digit, or any other sign. The QBASIC has the following character sets: ▪ Alphabets A, B.. Z, a, b, c,.....z. ▪ Number 0-9. ▪ Special symbols like ;,=, +,-,/,*,( ),%, $, #, &, ?,<, >etc. Character Set 19
  • 20. ▪ Keywords are the words that convey a special meaning to the language. ▪ These are reserved for special purpose and must not be used as normal identifier names. ▪ Some of the QBASIC keywords are: REM, CLS, INPUT, LET, PRINT and END Keywords (Reserved Words) 20 🔑
  • 21. Variable 21 ▪ Variables are the memory locations in the computer’s memory for storing data. ▪ They provide an “interface” to RAM. ▪ They are the containers that holds the information. ▪ Their sole purpose is to label and store the data in memory so that can be used throughout the program.
  • 22. The variable names have the following properties: 22 Continue…… Variable - Naming Conventions ▪ Any Variable name may be up to 40 characters long. ▪ Variable names must begin with a letter ( A…Z, a…z ). ▪ Cannot contain characters other than letters, numbers, period, and the type declaration characters ($, %, #, &, and ! ). ▪ Cannot be a reserved words, although embedded reserved words are allowed. ▪ Variable may represent either numeric values or string. ▪ Cannot begin with “FN” unless it is a function call.
  • 23. Variables occur in two distinct types i.e. numeric variable and string variable depending upon data item they represent. 23 Continue…… Types of variables ▪ Numeric Variable • Numeric variables store numeric data. • It’s name can be formed by letters and digits. • It should however always begin with an alphabet and should not contain any special characters or spaces. • For example, (i) age = 30 (ii) mark1 = 73.6. Here age is a numeric variable which stores the constant value 30. • Numeric variables may be declared as:
  • 24. 24 Continue…… Numeric Variable ▪ Integers • Integer variable is declared by using a percent sign (%) as the last character of the variable name • They are stored as 2 bytes ranging in value from -32768 to +32767. • The declaration of a variable as an integer causes the variable’s value to be rounded to the closest integer. • For example: A% = 50 • They accept only non-decimal values i.e real values
  • 25. 25 Continue…… Numeric Variable ▪ Long Integers • Long Integer variable is declared by using a ampersand sign (&) as the last character of the variable name. • They are stored as 4 bytes ranging in value from -2,147,483,648 to + 2,147,483,648 • For example: A& = 5023456
  • 26. 26 Continue…… Numeric Variable ▪ Single Precision • Single Precision variable is declared by using a exclamation sign (!) as the last character of the variable name • They are stored as 2 bytes ranging in value from -3.37 x 10^38 to + 3.3 x 10^38. • The declaration of a variable as single precision and exceeds seven digits is rounded to its closest value. • Although the seventh digit is displayed, its accuracy is not dependable. • For example: A! = 123.4567
  • 27. 27 Continue…… Numeric Variable ▪ Double Precision • Double Precision variable is declared by using a Hash sign (#) as the last character of the variable name • They are stored as 4 bytes ranging in value from -1.67 x 10^308 to + 1.67 x 10^308. • The declaration of a variable as double precision and exceeds 16 digits is rounded to its closest value. • For example: Count# = 123.4567
  • 28. 28 String Variable ▪ String variables represents numbers, alphabets, and special characters. ▪ This variable should: • begin with an alphabet. • end with dollar sign($). • be of more than one characters and numbers but no special characters are allowed ▪ Data are stored inside double quotation. ▪ Example: A$ = “Hello world”
  • 29. 29 Constant ▪ Constant is a value stored in a program which does not change during program execution. ▪ Based on the type of data, it is classified into two types: • Numeric Constant • Numeric constant is a numeric value on which mathematical operations such as addition, subtraction, multiplication and division can be performed. • It consists of sequence of digits (0-9) with or without decimal point. • It can be a positive or negative numbers. • Example: 17, -54, 23.5, -7.5.
  • 30. 30 Continue…… Constant • String constant is a set of alphanumeric or special characters enclosed within double quotes. • Blank spaces can also be used in a string. • These type of data cannot be used for mathematical calculations but can be used for comparisons and references. • For example: “Computer Science”, “Fluorescent” • String Constant • Symbolic Constant • Symbolic constant is used when a value is not expected to change during the execution of the program. • The CONST statement is a non-executable statement that declares symbolic constants. • For example: CONST PI = 22/7
  • 31. 31 Operator and Expression ▪ An operator is a symbol representing the operations they perform on operands in a program. ▪ The value on which the operators work are referred to as operands. ▪ An expression is a programming statements that has a value. ▪ It is composed of operators and operands. ▪ Operators perform mathematical or logical operations on values ▪ Types of Operators. • Arithmetic operators. • Relational operators. • Logical operators. • String operators.
  • 32. Arithmetic operators 32 ▪ Arithmetic operators performs arithmetic operations on the numeric values or on the variables holding numeric values. ▪ An expression formed with arithmetic operators is termed as arithmetic expressions. Operators Operations Example Result ^ Exponential X = 2 ^3 X = 8 - Negation x = -y X = -(9-3) X = - 6 * Multiplication X = 3 *3 X = 9 / Floating-point Division X = 5/2 X = 2.5 Integer Division X = 52 X = 2 MOD Modulus Division X = 5 MOD 2 X = 1 + Addition X = 3 + 4 X = 7 - Subtraction X = 6 – 3 X = 3
  • 33. Relational operators 33 ▪ Relational operators are used to evaluate and compare two values of the same type, either both numeric or both string. ▪ The result of comparison is either TRUE or FALSE. Operators Operations Example Result = Equal 6 = 5 False < Less than 6<5 False > Greater than 6>5 5>6 True False <= Less than or equal to 6<=5 5<=6 False True >= Greater than or equal to 6>=5 5>=6 True False <> Not equal to 6<>5 True
  • 34. Logical operators 34 ▪ Logical operators are used to connect two or more relational expressions to evaluate a single value as True or False. ▪ The logical operators supported by QBASIC are: ▪ AND operator • When two logical expressions are combined using AND logical operator, the entire logic operation will be TRUE only if both the logical expressions are individually TRUE. ▪ OR operator • The entire logic operation in this case will be TRUE if either of the logical expression is TRUE. ▪ NOT operator • Not is a negative check operator. It operates with one operand • It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false.
  • 35. Logical operators 35 ▪ Truth Table Value (A) Value (B) A AND B A OR B NOT A F F F F T F T F T T T F F T F T T T T F
  • 36. 36 Concatenation Operator ▪ An expression involving string variables and constants is called string expression. ▪ Concatenation operators connect multiple strings into a single string. ▪ QBASIC use the plus sign (+) as a string concatenation operator. ▪ QBASIC use the plus sign (+) as a string concatenation operator.
  • 37. THANKS! Any questions? You can find me at @https://www.slideshare.net/RoshanMaharjan13 & fsscomputer2020@gmail.com 37