際際滷

際際滷Share a Scribd company logo
QBasic andQBasic and
ProgrammingProgramming
PresentationPresentation
Prepared by:
Obusan, Janssen Roselle T.
Opiana, Christian Joseph I.
QBasic
It all started back in
1963 when John
Goerge Kemeny
and Tom Kurtzas
got together at
Dartmouth College.
It is an interpreter
which reads every
line, translates it and
lets the computer
execute it.
NOTE: BASIC stands for Beginners All Purpose
Instruction Code.
RulesRules and Itsand Its FeatureFeature
QBasic programs are
executed in the order
which they are
written.
Every statement
should have at least
one QBasic
command.
All commands have
to be written using
the Syntax Rules.
Syntax is the
grammar of writing.
It is a user friendly
language.
It is widely known
and accepted
programming
language.
It is one of the
most flexible
languages, as
modification can
easily be done.
Language is easy
since the variables
can be named
easily and uses
simple English
phrases.
DataData
(A collection of facts and figures that is entered into the computer.)(A collection of facts and figures that is entered into the computer.)
CONSTANTCONSTANT
(Data whose values do not change)
Numeric Constant
(numbers  negative or positive  used for mathematics)
e.g. 100
Alphanumeric Constant/String
(numbers of alphabets written within double quoutes)
e.g. computer
VARIABLEVARIABLE
(Data whose values can change fue to some calculation)
Numeric Variable
(numbers that are constant for arithmetic)
e.g. A = 50
Alphanumeric Variable
(variable that holds an Alphanumeric constant)
e.g. Name$ = Akanksha
ModesModes
(QBasic can be made to translate your instructions in two modes.)(QBasic can be made to translate your instructions in two modes.)
Direct
Mode
Progra
m Mode
Accepts single line instructions from the
user and the output is viewed as soon as
the key is pressed.
This mode is used to types a program which
is stored in the memory. They have line
numbers. We have to give the command to
get the output.
Note: Every programming language has its own SYNTAX (rules)
and COMMANDS.
Keywords and their FunctionsKeywords and their Functions
LIST
Used to list the
programs on the
screen.
RUN
Used to execute
the program.
LLIST
Used to list the
program as a
hardcopy.
LPRINT
Used to get the
output of the program
on the hard copy.
NEW
Used to clear the
memory of a existing
program.
Keywords and their FunctionsKeywords and their Functions
SYSTEM
Used to take
you back to dos
prompt.
PRINT & CLS
Print is used to
display on screen.
CLS is used to clear
the screen.
RME
Used to show the
position of the
mistake.
SAVE
Used to save the
program.
LOAD
Used to load the
program from the
disk to the memory.
QBasic CommandsQBasic Commands
CLS
This command is used to
clear the screen.
PRINT
This command is used to
display the output on the
screen.
REM
It stands for remark. It
makes the program more
understandable to the
reader.
LET
It assigns a value to a
variable in a program.
NOTE: A numeric data should be assigned to a numeric
variable and aplhanumeric data to an alphanumeric
variable.
QBasic CommandsQBasic Commands
END
This command is usually
given at the end of the
program.
INPUT
It allows the user to enter a
value for the variable while
running the program.
DELETE
To delete a line number in a
program.
QBasic Reminders!QBasic Reminders!
A program consists
of a line number.
It contains keywords
like: PRINT, END etc.
Each program line
begins with positive
number.
Run is used to
execute a program.
It is possible to overwrite a
statement but if you want to
write a new program, use
the NEW command.
To exit the QBasic
program, SYSTEM
command is used.
NO TWO
LINES
SHOULD
HAVE SAME
NUMBER.
When the PRINT command,When the PRINT command,
you can also print NUMBERSyou can also print NUMBERS
to the screen. Delete theto the screen. Delete the
current program (unless youcurrent program (unless you
already have) and write thealready have) and write the
following:following:
PRINT 512 (or ?512)PRINT 512 (or ?512)
<press enter><press enter>
Press F5 to run the program.Press F5 to run the program.
The program outputs:The program outputs:
512512
COMMANDSCOMMANDS
There are also specialThere are also special
functions calledfunctions called
COMMANDS (alsoCOMMANDS (also
calledcalled
INSTRUCTIONS). AINSTRUCTIONS). A
COMMAND tells theCOMMAND tells the
QBASIC interpreter to doQBASIC interpreter to do
something.something.
The PRINT commandThe PRINT command
tells the QBASICtells the QBASIC
interpreter to printinterpreter to print
something on the screen.something on the screen.
In this case, theIn this case, the
interpreter printedinterpreter printed
HELLO WORLD!.HELLO WORLD!.
TIP: Instead of typing
PRINT, you can enter a
question mark. For
example:
?HELLO WORLD!
EXPRESSIONSEXPRESSIONS
An expression is something the interpreterAn expression is something the interpreter
calculates (or evaluates). Such as:calculates (or evaluates). Such as:
1+11+1 (returns 2)(returns 2)
100-147100-147 (returns 53)(returns 53)
3*343*34 (returns102)(returns102)
80/480/4 (returns 20)(returns 20)
(100*3)+56(100*3)+56 (returns 356)(returns 356)
If you pass an expression to the
PRINT command, the value returned
(a number) is printed.
Clear the current program and then run the following:
PRINT 512+478
PROGRAM OUTPUT:
990
if you enclose the expression with quotation marks, the expression
becomes a string and isnt evaluated. For example:
PRINT 512+478
OUTPUT
512+478
ACTIVITYACTIVITY
1.1. EVALUATE:EVALUATE:
A.A. 14/2-3*1=14/2-3*1=
B.B. 8*2/(5-1)=8*2/(5-1)=
C.C. 3+5^2*4=3+5^2*4=
D.D. 4+(3*2-1)^2/5=4+(3*2-1)^2/5=
ACTIVITY(Continuation)ACTIVITY(Continuation)
2. EXPRESS IN INTEGER OR DECIMAL2. EXPRESS IN INTEGER OR DECIMAL
FORMFORM
A.A.5.0D+7=5.0D+7=
B.B.-1.23D+03=-1.23D+03=
C.C.1.234D-04=1.234D-04=
D.D.4.26305D+084.26305D+08
RETRIEVING KEYBOARDRETRIEVING KEYBOARD
INPUT FROM THE USERINPUT FROM THE USER
One way to receive input
from the keyboard is with
the INPUT command. The
INPUT command allows
the user to enter either a
string or a number, which
is then stored in a
variable.
INPUT data$
PRINT data $
When is the program executed, the
INPUT command displays a question
mark, followed by a blinking cursor. And
when you enter text, the program stores
that text into the variable data$, which is
printed to the screen.
TIP: if you place a string and a semi-colon
between INPUT and the variable, the
program will print the string.
INPUT ENTER SOME TEXT:; data$
To receive a number, use aTo receive a number, use a
non-string variable.non-string variable.
INPUT numberINPUT number
PRINT numberPRINT number
If you enter text instead of aIf you enter text instead of a
number, the QBASICnumber, the QBASIC
interpreter displays an errorinterpreter displays an error
message (Redo frommessage (Redo from
start).start).
RETRIEVING KEYBOARDRETRIEVING KEYBOARD
INPUT FROM THE USERINPUT FROM THE USER
Below is another example of
the INPUT command:
PRINT Enter some text:
INPUT text$
PRINT Now enter a
number:
INPUT num
PRINT text$
PRINT num
THE IF AND THEN COMMANDS
The IF and THEN commands
are used to compare an
expression and then perform
some task based on that
expression.
X=5
IF X=5 THEN PRINT  X equals
5
Since X does equal 5 in this
case, the program outputs:
X equals 5
EXPRESSION SIGNS
You can also enter the
following statements,
instead of the equals sign:
X<5 (x is less than 5)
X>5 (x is greater than 5)
Run the following:
X=16
IF(X>5) THEN PRINT X is
greater than 5
THE IF AND THEN COMMANDSTHE IF AND THEN COMMANDS
You can also combine the
signs like this:
x<=5 (x is less than or equal
to 5)
X>=5 (x is greater than or
equal to 5)
X<>5 (x does not equal to 5)
Run the following example:
CLS
X=5
IF (X>=5) THEN PRINT X is
greater than equal to 5
IF (X<=5) THEN PRINT X is
less than or equal to 5
IF (X<>5) THEN PRINT X
does not equal to 5
OUTPUT:
X is greater than or equal to
5
X is less than or equal to 5
ELSEELSE
Using the ELSE command, you can
have the program perform a different
action if the statement is false.
x=3
IF x=5 THEN PRINT Yes ELSE PRINT
No
Since X doesnt equal to 5, the output
is:
No
END IF
END IF allows you to have multiple
commands after the IF THEN
statement, but they must start on
the line after the IF statement. END
IF should appear right after the list
of commands.
Prepared by:Prepared by:
Obusan, Janssen Roselle T.Obusan, Janssen Roselle T.
Opiana, Christian Joseph I.Opiana, Christian Joseph I.

More Related Content

What's hot (20)

Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
salmankhan570
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
Jordan Delacruz
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
hermiraguilar
C program compiler presentation
C program compiler presentationC program compiler presentation
C program compiler presentation
Rigvendra Kumar Vardhan
Qbasic
QbasicQbasic
Qbasic
Shubham Gupta
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f c
Raja Hamid
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
Programming : QBASIC
Programming : QBASICProgramming : QBASIC
Programming : QBASIC
vnuvalcrepollo
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
mshellman
Theory of programming
Theory of programmingTheory of programming
Theory of programming
tcc_joemarie
Programming languages
Programming languagesProgramming languages
Programming languages
www.myassignmenthelp.net
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Rokonuzzaman Rony
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
Giordano Scalzo
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
jovelleluzon
Pseudocode
PseudocodePseudocode
Pseudocode
Harsha Madushanka
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
Jyothishmathi Institute of Technology and Science Karimnagar
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
Coding
CodingCoding
Coding
Vishal Singh
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
Damian T. Gordon
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
salmankhan570
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
Jordan Delacruz
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
hermiraguilar
Programming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f cProgramming fundamentals lecture 1 0f c
Programming fundamentals lecture 1 0f c
Raja Hamid
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
Programming : QBASIC
Programming : QBASICProgramming : QBASIC
Programming : QBASIC
vnuvalcrepollo
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
mshellman
Theory of programming
Theory of programmingTheory of programming
Theory of programming
tcc_joemarie
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Rokonuzzaman Rony
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
Giordano Scalzo
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
jovelleluzon
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
Damian T. Gordon

Similar to Qbasic introduction (20)

The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
Enelrah Vanna Dela Cruz
Basic computer-programming-2
Basic computer-programming-2Basic computer-programming-2
Basic computer-programming-2
lemonmichelangelo
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
arisamae1114
programming.ppt
programming.pptprogramming.ppt
programming.ppt
AdrianVANTOPINA
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
livecoding.tv
Programming
ProgrammingProgramming
Programming
Leo Simon Anfone
Basic programming
Basic programmingBasic programming
Basic programming
Nicole Danielle Mallari
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
Niropam Das
Map reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICSMap reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICS
Archana Gopinath
Introduction to Python programming
Introduction to Python programmingIntroduction to Python programming
Introduction to Python programming
Damian T. Gordon
Algorithm Design and Problem Solving [Autosaved].pptx
Algorithm Design and Problem Solving [Autosaved].pptxAlgorithm Design and Problem Solving [Autosaved].pptx
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
A tutorial on C++ Programming
A tutorial on C++ ProgrammingA tutorial on C++ Programming
A tutorial on C++ Programming
Prof. Erwin Globio
Input-output
Input-outputInput-output
Input-output
neda marie maramo
vingautosaved-230525024624-6a6fb3b2.pptx
vingautosaved-230525024624-6a6fb3b2.pptxvingautosaved-230525024624-6a6fb3b2.pptx
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
Computer programming
Computer programmingComputer programming
Computer programming
Vincent Valenzuela
BASIC programming language presentation.pptx
BASIC programming language presentation.pptxBASIC programming language presentation.pptx
BASIC programming language presentation.pptx
Chinedu Francis Njemanze
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptxBikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa Thapa
Computer programming
Computer programmingComputer programming
Computer programming
Leigh-ann Garrote
Basic computer-programming-2
Basic computer-programming-2Basic computer-programming-2
Basic computer-programming-2
lemonmichelangelo
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern ProgrammingQBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
arisamae1114
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1ILearn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
livecoding.tv
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
Niropam Das
Map reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICSMap reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICS
Archana Gopinath
Introduction to Python programming
Introduction to Python programmingIntroduction to Python programming
Introduction to Python programming
Damian T. Gordon
Algorithm Design and Problem Solving [Autosaved].pptx
Algorithm Design and Problem Solving [Autosaved].pptxAlgorithm Design and Problem Solving [Autosaved].pptx
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
A tutorial on C++ Programming
A tutorial on C++ ProgrammingA tutorial on C++ Programming
A tutorial on C++ Programming
Prof. Erwin Globio
vingautosaved-230525024624-6a6fb3b2.pptx
vingautosaved-230525024624-6a6fb3b2.pptxvingautosaved-230525024624-6a6fb3b2.pptx
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
BASIC programming language presentation.pptx
BASIC programming language presentation.pptxBASIC programming language presentation.pptx
BASIC programming language presentation.pptx
Chinedu Francis Njemanze
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptxBikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa Thapa

Recently uploaded (16)

Research Rabbit Research Rabbit Research Rabbit Research Rabbit
Research Rabbit Research Rabbit Research Rabbit Research RabbitResearch Rabbit Research Rabbit Research Rabbit Research Rabbit
Research Rabbit Research Rabbit Research Rabbit Research Rabbit
ThanhNguyn856080
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptxMIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
ErikRobinson14
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptxSensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sudhanshu278904
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdfenterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
RAJAGOPAL RAMACHANDRAN
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
rmukeskannan2005
Campus life leveragun rhe tida ycvhcjkcncj
Campus life leveragun rhe tida ycvhcjkcncjCampus life leveragun rhe tida ycvhcjkcncj
Campus life leveragun rhe tida ycvhcjkcncj
abhisinghroy21
W03-L04 Content Addressable Network (1).pptx
W03-L04 Content Addressable Network (1).pptxW03-L04 Content Addressable Network (1).pptx
W03-L04 Content Addressable Network (1).pptx
AliAbbas835233
Module-4 Insurance Plannihzjajanzng.pptx
Module-4 Insurance Plannihzjajanzng.pptxModule-4 Insurance Plannihzjajanzng.pptx
Module-4 Insurance Plannihzjajanzng.pptx
divya995yahoo
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
edget1
Predictive Maitenance using IoT for Smart Manufacturing System
Predictive Maitenance using IoT for Smart Manufacturing SystemPredictive Maitenance using IoT for Smart Manufacturing System
Predictive Maitenance using IoT for Smart Manufacturing System
Rajesh Madathil
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
edget1
Manpreet kay bhatia Business Statistics.ppt
Manpreet kay bhatia Business  Statistics.pptManpreet kay bhatia Business  Statistics.ppt
Manpreet kay bhatia Business Statistics.ppt
Noorien3
Mobile Computing power point presentationQuantum.pptx
Mobile Computing  power point presentationQuantum.pptxMobile Computing  power point presentationQuantum.pptx
Mobile Computing power point presentationQuantum.pptx
manisingh970614
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdfverlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
ethantaruc
Install Software Application buze 1 new.pptx
Install Software Application buze 1 new.pptxInstall Software Application buze 1 new.pptx
Install Software Application buze 1 new.pptx
Bizunehgetu
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
hashhshs786
Research Rabbit Research Rabbit Research Rabbit Research Rabbit
Research Rabbit Research Rabbit Research Rabbit Research RabbitResearch Rabbit Research Rabbit Research Rabbit Research Rabbit
Research Rabbit Research Rabbit Research Rabbit Research Rabbit
ThanhNguyn856080
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptxMIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
MIN_3-11.4kTL-XH-US_User_Manual_EN_202306.pptx
ErikRobinson14
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptxSensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sensors DTH11 PIR HC-05 (2) of sudhanshu.pptx
Sudhanshu278904
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdfenterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
enterprise_command_centre-roadmap_using_IBM_safer_planet_20180507.pdf
RAJAGOPAL RAMACHANDRAN
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
1bca.nsusnusnsigzitziyziyzoyzkyzoykg kyxpdf
rmukeskannan2005
Campus life leveragun rhe tida ycvhcjkcncj
Campus life leveragun rhe tida ycvhcjkcncjCampus life leveragun rhe tida ycvhcjkcncj
Campus life leveragun rhe tida ycvhcjkcncj
abhisinghroy21
W03-L04 Content Addressable Network (1).pptx
W03-L04 Content Addressable Network (1).pptxW03-L04 Content Addressable Network (1).pptx
W03-L04 Content Addressable Network (1).pptx
AliAbbas835233
Module-4 Insurance Plannihzjajanzng.pptx
Module-4 Insurance Plannihzjajanzng.pptxModule-4 Insurance Plannihzjajanzng.pptx
Module-4 Insurance Plannihzjajanzng.pptx
divya995yahoo
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
Update Doc.pptxUpdateUpdateUpdateUpdateUpdate Doc.pptxUpdateUpdateUpdateUpdat...
edget1
Predictive Maitenance using IoT for Smart Manufacturing System
Predictive Maitenance using IoT for Smart Manufacturing SystemPredictive Maitenance using IoT for Smart Manufacturing System
Predictive Maitenance using IoT for Smart Manufacturing System
Rajesh Madathil
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
M08 Maintenance Procedure.pdfConnect Hard Ware Perie PPT - Connect Hard Ware ...
edget1
Manpreet kay bhatia Business Statistics.ppt
Manpreet kay bhatia Business  Statistics.pptManpreet kay bhatia Business  Statistics.ppt
Manpreet kay bhatia Business Statistics.ppt
Noorien3
Mobile Computing power point presentationQuantum.pptx
Mobile Computing  power point presentationQuantum.pptxMobile Computing  power point presentationQuantum.pptx
Mobile Computing power point presentationQuantum.pptx
manisingh970614
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdfverlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
verlogic3_chapteDDZXCCASCASCASCASCASC8.pdf
ethantaruc
Install Software Application buze 1 new.pptx
Install Software Application buze 1 new.pptxInstall Software Application buze 1 new.pptx
Install Software Application buze 1 new.pptx
Bizunehgetu
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
LATEST-CRACK Adobe Illustrator CC 2018 23.0.0
hashhshs786

Qbasic introduction

  • 1. QBasic andQBasic and ProgrammingProgramming PresentationPresentation Prepared by: Obusan, Janssen Roselle T. Opiana, Christian Joseph I.
  • 2. QBasic It all started back in 1963 when John Goerge Kemeny and Tom Kurtzas got together at Dartmouth College. It is an interpreter which reads every line, translates it and lets the computer execute it. NOTE: BASIC stands for Beginners All Purpose Instruction Code.
  • 3. RulesRules and Itsand Its FeatureFeature QBasic programs are executed in the order which they are written. Every statement should have at least one QBasic command. All commands have to be written using the Syntax Rules. Syntax is the grammar of writing. It is a user friendly language. It is widely known and accepted programming language. It is one of the most flexible languages, as modification can easily be done. Language is easy since the variables can be named easily and uses simple English phrases.
  • 4. DataData (A collection of facts and figures that is entered into the computer.)(A collection of facts and figures that is entered into the computer.) CONSTANTCONSTANT (Data whose values do not change) Numeric Constant (numbers negative or positive used for mathematics) e.g. 100 Alphanumeric Constant/String (numbers of alphabets written within double quoutes) e.g. computer VARIABLEVARIABLE (Data whose values can change fue to some calculation) Numeric Variable (numbers that are constant for arithmetic) e.g. A = 50 Alphanumeric Variable (variable that holds an Alphanumeric constant) e.g. Name$ = Akanksha
  • 5. ModesModes (QBasic can be made to translate your instructions in two modes.)(QBasic can be made to translate your instructions in two modes.) Direct Mode Progra m Mode Accepts single line instructions from the user and the output is viewed as soon as the key is pressed. This mode is used to types a program which is stored in the memory. They have line numbers. We have to give the command to get the output. Note: Every programming language has its own SYNTAX (rules) and COMMANDS.
  • 6. Keywords and their FunctionsKeywords and their Functions LIST Used to list the programs on the screen. RUN Used to execute the program. LLIST Used to list the program as a hardcopy. LPRINT Used to get the output of the program on the hard copy. NEW Used to clear the memory of a existing program.
  • 7. Keywords and their FunctionsKeywords and their Functions SYSTEM Used to take you back to dos prompt. PRINT & CLS Print is used to display on screen. CLS is used to clear the screen. RME Used to show the position of the mistake. SAVE Used to save the program. LOAD Used to load the program from the disk to the memory.
  • 8. QBasic CommandsQBasic Commands CLS This command is used to clear the screen. PRINT This command is used to display the output on the screen. REM It stands for remark. It makes the program more understandable to the reader. LET It assigns a value to a variable in a program. NOTE: A numeric data should be assigned to a numeric variable and aplhanumeric data to an alphanumeric variable.
  • 9. QBasic CommandsQBasic Commands END This command is usually given at the end of the program. INPUT It allows the user to enter a value for the variable while running the program. DELETE To delete a line number in a program.
  • 10. QBasic Reminders!QBasic Reminders! A program consists of a line number. It contains keywords like: PRINT, END etc. Each program line begins with positive number. Run is used to execute a program. It is possible to overwrite a statement but if you want to write a new program, use the NEW command. To exit the QBasic program, SYSTEM command is used. NO TWO LINES SHOULD HAVE SAME NUMBER.
  • 11. When the PRINT command,When the PRINT command, you can also print NUMBERSyou can also print NUMBERS to the screen. Delete theto the screen. Delete the current program (unless youcurrent program (unless you already have) and write thealready have) and write the following:following: PRINT 512 (or ?512)PRINT 512 (or ?512) <press enter><press enter> Press F5 to run the program.Press F5 to run the program. The program outputs:The program outputs: 512512 COMMANDSCOMMANDS There are also specialThere are also special functions calledfunctions called COMMANDS (alsoCOMMANDS (also calledcalled INSTRUCTIONS). AINSTRUCTIONS). A COMMAND tells theCOMMAND tells the QBASIC interpreter to doQBASIC interpreter to do something.something. The PRINT commandThe PRINT command tells the QBASICtells the QBASIC interpreter to printinterpreter to print something on the screen.something on the screen. In this case, theIn this case, the interpreter printedinterpreter printed HELLO WORLD!.HELLO WORLD!. TIP: Instead of typing PRINT, you can enter a question mark. For example: ?HELLO WORLD!
  • 12. EXPRESSIONSEXPRESSIONS An expression is something the interpreterAn expression is something the interpreter calculates (or evaluates). Such as:calculates (or evaluates). Such as: 1+11+1 (returns 2)(returns 2) 100-147100-147 (returns 53)(returns 53) 3*343*34 (returns102)(returns102) 80/480/4 (returns 20)(returns 20) (100*3)+56(100*3)+56 (returns 356)(returns 356)
  • 13. If you pass an expression to the PRINT command, the value returned (a number) is printed. Clear the current program and then run the following: PRINT 512+478 PROGRAM OUTPUT: 990 if you enclose the expression with quotation marks, the expression becomes a string and isnt evaluated. For example: PRINT 512+478 OUTPUT 512+478
  • 14. ACTIVITYACTIVITY 1.1. EVALUATE:EVALUATE: A.A. 14/2-3*1=14/2-3*1= B.B. 8*2/(5-1)=8*2/(5-1)= C.C. 3+5^2*4=3+5^2*4= D.D. 4+(3*2-1)^2/5=4+(3*2-1)^2/5=
  • 15. ACTIVITY(Continuation)ACTIVITY(Continuation) 2. EXPRESS IN INTEGER OR DECIMAL2. EXPRESS IN INTEGER OR DECIMAL FORMFORM A.A.5.0D+7=5.0D+7= B.B.-1.23D+03=-1.23D+03= C.C.1.234D-04=1.234D-04= D.D.4.26305D+084.26305D+08
  • 16. RETRIEVING KEYBOARDRETRIEVING KEYBOARD INPUT FROM THE USERINPUT FROM THE USER One way to receive input from the keyboard is with the INPUT command. The INPUT command allows the user to enter either a string or a number, which is then stored in a variable. INPUT data$ PRINT data $ When is the program executed, the INPUT command displays a question mark, followed by a blinking cursor. And when you enter text, the program stores that text into the variable data$, which is printed to the screen. TIP: if you place a string and a semi-colon between INPUT and the variable, the program will print the string. INPUT ENTER SOME TEXT:; data$
  • 17. To receive a number, use aTo receive a number, use a non-string variable.non-string variable. INPUT numberINPUT number PRINT numberPRINT number If you enter text instead of aIf you enter text instead of a number, the QBASICnumber, the QBASIC interpreter displays an errorinterpreter displays an error message (Redo frommessage (Redo from start).start). RETRIEVING KEYBOARDRETRIEVING KEYBOARD INPUT FROM THE USERINPUT FROM THE USER Below is another example of the INPUT command: PRINT Enter some text: INPUT text$ PRINT Now enter a number: INPUT num PRINT text$ PRINT num
  • 18. THE IF AND THEN COMMANDS The IF and THEN commands are used to compare an expression and then perform some task based on that expression. X=5 IF X=5 THEN PRINT X equals 5 Since X does equal 5 in this case, the program outputs: X equals 5 EXPRESSION SIGNS You can also enter the following statements, instead of the equals sign: X<5 (x is less than 5) X>5 (x is greater than 5) Run the following: X=16 IF(X>5) THEN PRINT X is greater than 5
  • 19. THE IF AND THEN COMMANDSTHE IF AND THEN COMMANDS You can also combine the signs like this: x<=5 (x is less than or equal to 5) X>=5 (x is greater than or equal to 5) X<>5 (x does not equal to 5) Run the following example: CLS X=5 IF (X>=5) THEN PRINT X is greater than equal to 5 IF (X<=5) THEN PRINT X is less than or equal to 5 IF (X<>5) THEN PRINT X does not equal to 5 OUTPUT: X is greater than or equal to 5 X is less than or equal to 5
  • 20. ELSEELSE Using the ELSE command, you can have the program perform a different action if the statement is false. x=3 IF x=5 THEN PRINT Yes ELSE PRINT No Since X doesnt equal to 5, the output is: No END IF END IF allows you to have multiple commands after the IF THEN statement, but they must start on the line after the IF statement. END IF should appear right after the list of commands.
  • 21. Prepared by:Prepared by: Obusan, Janssen Roselle T.Obusan, Janssen Roselle T. Opiana, Christian Joseph I.Opiana, Christian Joseph I.