SlideShare a Scribd company logo
8
Oval Terminal Symbol
Parallelogram Input/Output
Rectangle Process
Diamond Decision
Hexagon Initialization/Preparation
Arrow Lines & Arrow
Heads
Direction
Annotation
Circle On Page Connector
Pentagon Odd-Page connector
Most read
12
Commands
There are also special functions called "commands" (also called "instructions").
A "command" tells the QBasic interpreter to do something.
The PRINT command tells the QBasic interpreter to print something to the
screen. In this case, the interpreter printed"Hello World!".
TIP: Instead of typing PRINT, you can enter a question mark. For example:
?"Hello World!"
With the PRINT command, you can also print numbers to the screen. Delete
the current program (unless you already have) and write the
following:PRINT 512 (or ?512)
<press Enter>
Press F5 to run the program. The program outputs:512
Most read
13
More about the PRINT command
You can use multiple print statements in your program.PRINT "Hello"
PRINT "World"
Output:Hello
World
To place World onto the previous line, place a semi-colon
after PRINT "Hello".PRINT "Hello";
PRINT "World"
Output:HelloWorld
Also, if you put a comma instead of a semi-colon on the first line, the program will
insert spaces between the two words.PRINT "Hello",
PRINT "World"
Output:Hello World
Most read
INTRODUCTION to
Programming and QBasic
By: Nyrhon Von V. Bautista
and Mhon Vincent S. Saldivar
JGMNHS G9-SSC-Lavoisier
Programming???? A brief background
• Programming is a set of step by step instructions
that tells or direct the computer what to do. It
sequences the tasks a user wants to be done and
produces the results or output needed.
• The set of rules or instructions that tells the
computer what to perform is done through a
programming languange. In this tutorial we will
use the QBASIC programming language.
• A programmer is the person who designs a
program.
Planning the
Solution
Coding the
Program
Testing the
Program
-Desk Checking
-Translation
-Debugging
Documentation
Identifying the
Problem
PROGRAM
LIFE
CYCLE
Did you know that the first
programmed word is
“HELLO WORLD”
LEVELS OF PROGRAMMING LANGUAGES
Machine Language or First Generation Programming Language
-this is considered to be the lowest level of programming
language.
Assembly Language or Second Generation of Programming
Language
-instead of using 1s and 0s assembly language uses MNEMONIC
Codes. Mnemonic codes are abbreviations that easy to
remember
High Level Language or Third Generation Programming
Language
-this language transformed programming in the early 1960’s.
Very High Level Languages or Fourth Generation Languages
-Fourth generation languages (4GL) simplifies further the third
level generation languages.
Natural Languages
- These languages are considered to be the fifth
Generation languages. These programming languages are called
Natural Languages because of their resemblance to
English Language.
Procedural Languages
Programming languages which are considered
procedural that uses a series of instructions or statements which
are sequential from the beginning to the end.
Examples of Procedural Languages:
BASIC – Beginner’s All-Purpose Symbolic Instruction Code
COBOL – Common Business Oriented Language
PASCAL
FORTRAN- Formula Translator
C
PL1 – Programming Language One
Non-procedural
Languages
These Programming languages are considered as object-
oriented programming languages. It is different from
procedural language since statements are not executed line
per line instead a series of instructions are executed as a whole
when an event occurs.
Examples of Non-procedural Languages
VISUAL BASIC
C++
JAVA
DELPHI
FLOWCHARTING
Flowcharting is one of the processes used in
designing or planning the solution to a
problem. It is a graphical representation to the
solution of a problem. It uses shapes to show
instructions and arrow lines and heads to
display the flow. It uses the shapes OVAL,
PARALLELOGRAM, RECTANGLE,
DIAMOND,CIRCLE & PENTAGON
Oval Terminal Symbol
Parallelogram Input/Output
Rectangle Process
Diamond Decision
Hexagon Initialization/Preparation
Arrow Lines & Arrow
Heads
Direction
Annotation
Circle On Page Connector
Pentagon Odd-Page connector
Qbasic Tutorial
After launching the QBasic interpreter (see before you start), you might
see a window requesting a list of "parameters." If this window comes up,
press the Enter key to continue.
You should now see the QBasic interpreter, which has a blue
background and displays a dialog box at the center. (If the interpreter
fills the entire screen, then you may want to press "Alt + Enter," to make
it smaller.)
Press the Esc key to hide the dialog box.
QBasic interpreter - main screen
Type the following (including the quotation marks) in the QBasic interpreter:
PRINT "Hello World!" <press Enter>
Now press F5 to run the program. You should now see a black screen,
with Hello World at the top, and Press any key to continue at the bottom.
Press a key on the keyboard to return to the main screen.
(The figure below displays the "output screen.")
Basic interpreter - output screen
If you run the program again, the interpreter adds another Hello World. QBasic
adds Hello World each time the program is run.
Deleting the program
To erase the current program:Go to the "File" menu.
Click "New."
The interpreter asks if you want to save the program.
Select "No" (or if you'd rather keep the program, select "Yes").
Strings
There are certain types of data (or information) called "strings." Strings contain a sequence of
characters (letters, numbers, and symbols) enclosed in quotation marks. For
example, "Hello World!" is a string.
The following are also strings:
"0123456789"
"This is a string"
"abc123"
"1 + 1 = 2"
Commands
There are also special functions called "commands" (also called "instructions").
A "command" tells the QBasic interpreter to do something.
The PRINT command tells the QBasic interpreter to print something to the
screen. In this case, the interpreter printed"Hello World!".
TIP: Instead of typing PRINT, you can enter a question mark. For example:
?"Hello World!"
With the PRINT command, you can also print numbers to the screen. Delete
the current program (unless you already have) and write the
following:PRINT 512 (or ?512)
<press Enter>
Press F5 to run the program. The program outputs:512
More about the PRINT command
You can use multiple print statements in your program.PRINT "Hello"
PRINT "World"
Output:Hello
World
To place World onto the previous line, place a semi-colon
after PRINT "Hello".PRINT "Hello";
PRINT "World"
Output:HelloWorld
Also, if you put a comma instead of a semi-colon on the first line, the program will
insert spaces between the two words.PRINT "Hello",
PRINT "World"
Output:Hello World
Variables
This chapter discusses an important topic in programming, "variables." Please read
this section thoroughly.
A variable is a piece of data kept in the computer's memory (RAM). The location of a
variable in RAM is called the"address."
How a variable is stored in RAM
The following program prints the variable X to the screen:print X
Since the variable hasn't been assigned a number, the value of the variable is 0. So, the
output of the program is:0
This next program sets X to 15, and then prints the variable:
X = 15
print X
This time, the output is:15
In the above example, the number 15 was stored in the computer's RAM at a certain
memory address. Then the PRINTcommand accessed (or looked at) that address when it
printed "15" to the screen.
Expressions
If you pass an expression to a variable, the expression is evaluated and the variable is set to that
value.x = 500 + (10 * 7)
PRINT x
Output:570
You can also use variables as expressions.rate = 50
time = 2
distance = rate * time
PRINT distance
Output:100
Plus, you can have both variables and numbers in an expression.X = 100
Y = X * 7
PRINT Y
Output:700
TIP: The following increases X by 1:
X = X + 1
Strings
If you add a dollar sign ($) to the end of a variable, the variable is a string.X$ = "Hello World!"
PRINT X$
Output:Hello World!
If you try to set a string to a non-string variable, an error occurs.X = "Hello World!"
The QBasic interpreter says "Type mismatch" when you try to run the above program.
A string can be added to the end of an existing variable string.X$ = "Hello"
X$ = X$ + "World"
PRINT X$
Output:HelloWorld
You can also add variable strings together.a$ = "String1"
b$ = "String2"
c$ = "String3"
d$ = a$ + b$ + c$
PRINT d$
Output:String1String2String3
Retrieving keyboard input 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 this program is 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 a non-string variable.INPUT number
PRINT number
If you enter text instead of a number, the QBasic interpreter displays an error
message ("Redo from start").
To receive a number, use a non-string variable.INPUT number
PRINT number
If you enter text instead of a number, the QBasic interpreter displays an error
message ("Redo from start").
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
TIP: You can have the question mark displayed on the previous line by using a
semi-colon.
PRINT "Enter some text:";
INPUT text$
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"
Output:x is greater than 5
ELSE
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 doesn't equal 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 theIF statement. END IF should appear
right after the list of commands.x = 5
IF (x = 5) THEN
INPUT a$
PRINT a$
END IF
The following program uses ELSE with the END IF command:x = 16
IF (x = 5) THEN
INPUT a$
PRINT a$
ELSE
PRINT x * 2
END IF
Output:32
TIP: There is a way to have multiple commands after IF...THENwithout
using END IF. To do so, place a colon between each command.
IF (x = 5) THEN INPUT a$: PRINT a$
THANK
YOU
FOR INQUIRIES Contact us.
https://www.facebook.com/mhonarch
https://www.facebook.com/eirelavlavun?fref=ts
Or Email us at hillcypress89@yahoo.com

More Related Content

What's hot (20)

Societal multilingualism
Societal multilingualism
Winda Widia
 
Computer languages
Computer languages
AqdasNoor
 
CALL - Computer Assisted Language Learning
CALL - Computer Assisted Language Learning
Dilip Barad
 
Introduction of Sociolinguistics and describes Language variation, Linguistic...
Introduction of Sociolinguistics and describes Language variation, Linguistic...
Sardarsinh Solanki
 
2nd material linguistics design language features 2014
2nd material linguistics design language features 2014
Ayu Juwita
 
Programming Fundamental Presentation
Programming Fundamental Presentation
fazli khaliq
 
Qbasic
Qbasic
Shubham Gupta
 
Corpus Tools for Language Teaching
Corpus Tools for Language Teaching
CALPER
 
Task-based Language Teaching
Task-based Language Teaching
Patrmartin
 
Best Practices for Teaching English to Young Learners by Joan Shin
Best Practices for Teaching English to Young Learners by Joan Shin
Venezuela TESOL
 
Fundamentals of CLIL
Fundamentals of CLIL
Yamith José Fandiño Parra
 
Introduction to programming
Introduction to programming
Gwyneth Calica
 
A.content based instruction (cbi)
A.content based instruction (cbi)
diah Cwek Tauruz
 
Introduction to MS Office
Introduction to MS Office
cristy nazareno
 
Direct method by m.hasnnain
Direct method by m.hasnnain
Muhammad Haseeb
 
Introduction to computer programming
Introduction to computer programming
NSU-Biliran Campus
 
SKILL BASED SYLLABUS
SKILL BASED SYLLABUS
Aillen Goleña
 
The audio lingual method
The audio lingual method
omarswan
 
Linguistic Imperialism
Linguistic Imperialism
Aiden Yeh
 
Teaching speaking brown
Teaching speaking brown
shohreh12345
 
Societal multilingualism
Societal multilingualism
Winda Widia
 
Computer languages
Computer languages
AqdasNoor
 
CALL - Computer Assisted Language Learning
CALL - Computer Assisted Language Learning
Dilip Barad
 
Introduction of Sociolinguistics and describes Language variation, Linguistic...
Introduction of Sociolinguistics and describes Language variation, Linguistic...
Sardarsinh Solanki
 
2nd material linguistics design language features 2014
2nd material linguistics design language features 2014
Ayu Juwita
 
Programming Fundamental Presentation
Programming Fundamental Presentation
fazli khaliq
 
Corpus Tools for Language Teaching
Corpus Tools for Language Teaching
CALPER
 
Task-based Language Teaching
Task-based Language Teaching
Patrmartin
 
Best Practices for Teaching English to Young Learners by Joan Shin
Best Practices for Teaching English to Young Learners by Joan Shin
Venezuela TESOL
 
Introduction to programming
Introduction to programming
Gwyneth Calica
 
A.content based instruction (cbi)
A.content based instruction (cbi)
diah Cwek Tauruz
 
Introduction to MS Office
Introduction to MS Office
cristy nazareno
 
Direct method by m.hasnnain
Direct method by m.hasnnain
Muhammad Haseeb
 
Introduction to computer programming
Introduction to computer programming
NSU-Biliran Campus
 
The audio lingual method
The audio lingual method
omarswan
 
Linguistic Imperialism
Linguistic Imperialism
Aiden Yeh
 
Teaching speaking brown
Teaching speaking brown
shohreh12345
 

Viewers also liked (19)

QBASIC
QBASIC
nivi88
 
Qbasic introduction
Qbasic introduction
Christian Joseph Opiana
 
Qbasic Tutorial
Qbasic Tutorial
Joy Hilary Yambao
 
Qbasic program
Qbasic program
Fercie Caseria
 
The Knowledge of QBasic
The Knowledge of QBasic
Enelrah Vanna Dela Cruz
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
 
Ch02 mis-imp-concepts
Ch02 mis-imp-concepts
SR NAIDU
 
Lec monitor
Lec monitor
Protik Roy
 
Lecture 1 mis
Lecture 1 mis
sukhalalton1
 
Lect 30 dbms_fundamentals
Lect 30 dbms_fundamentals
Protik Roy
 
Management information system Unit 1
Management information system Unit 1
Sharda University Greater Noida
 
Lecture 11 bmbs management information system qs
Lecture 11 bmbs management information system qs
Muhammad Ovais
 
Mis 001
Mis 001
Kinshook Chaturvedi
 
Ch01
Ch01
Taha Khan
 
Management information system
Management information system
Ranjeeta Swarnakar
 
Laudon mis12 ppt01
Laudon mis12 ppt01
Norazila Mat
 
MIS Chapter 1
MIS Chapter 1
Dara Som
 
Mis lecture ppt
Mis lecture ppt
Vandana Agrawal
 
Management Information System (Full Notes)
Management Information System (Full Notes)
Harish Chand
 
Ad

Similar to Introduction to Programming and QBasic Tutorial (20)

Computer programming k 12
Computer programming k 12
lemonmichelangelo
 
Basic Computer Programming
Basic Computer Programming
Allen de Castro
 
programming.ppt
programming.ppt
AdrianVANTOPINA
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
livecoding.tv
 
Basic computer-programming-2
Basic computer-programming-2
lemonmichelangelo
 
Programming
Programming
Leo Simon Anfone
 
Assembly Language Programming
Assembly Language Programming
Niropam Das
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMING
arisamae1114
 
The basics of c programming
The basics of c programming
Muhammed Thanveer M
 
C language industrial training report
C language industrial training report
Raushan Pandey
 
Algorithms and flowcharts
Algorithms and flowcharts
Samuel Igbanogu
 
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
abdurrahimk182
 
Input-output
Input-output
neda marie maramo
 
Python Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
A tutorial on C++ Programming
A tutorial on C++ Programming
Prof. Erwin Globio
 
Flowcharts and Introduction to computers
Flowcharts and Introduction to computers
ssuser2023c6
 
Flowchart presentation that can be useful
Flowchart presentation that can be useful
ssuser2023c6
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
 
Learning R while exploring statistics
Learning R while exploring statistics
Dorothy Bishop
 
Basic programming
Basic programming
Nicole Danielle Mallari
 
Basic Computer Programming
Basic Computer Programming
Allen de Castro
 
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
Learn Programming with Livecoding.tv http://goo.gl/tIgO1I
livecoding.tv
 
Basic computer-programming-2
Basic computer-programming-2
lemonmichelangelo
 
Assembly Language Programming
Assembly Language Programming
Niropam Das
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMING
arisamae1114
 
C language industrial training report
C language industrial training report
Raushan Pandey
 
Algorithms and flowcharts
Algorithms and flowcharts
Samuel Igbanogu
 
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
C PLUS PLUS FOR BS ELECTRICAL 2ND SEMSTERLecture01.ppt
abdurrahimk182
 
Python Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
Flowcharts and Introduction to computers
Flowcharts and Introduction to computers
ssuser2023c6
 
Flowchart presentation that can be useful
Flowchart presentation that can be useful
ssuser2023c6
 
QBASIC: A Tool For Modern Programming
QBASIC: A Tool For Modern Programming
Gifty Belle Manaois
 
Learning R while exploring statistics
Learning R while exploring statistics
Dorothy Bishop
 
Ad

Recently uploaded (20)

june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...
Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...
National Information Standards Organization (NISO)
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Manage Maintenance Request in Odoo 18
How to Manage Maintenance Request in Odoo 18
Celine George
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 

Introduction to Programming and QBasic Tutorial

  • 1. INTRODUCTION to Programming and QBasic By: Nyrhon Von V. Bautista and Mhon Vincent S. Saldivar JGMNHS G9-SSC-Lavoisier
  • 2. Programming???? A brief background • Programming is a set of step by step instructions that tells or direct the computer what to do. It sequences the tasks a user wants to be done and produces the results or output needed. • The set of rules or instructions that tells the computer what to perform is done through a programming languange. In this tutorial we will use the QBASIC programming language. • A programmer is the person who designs a program.
  • 3. Planning the Solution Coding the Program Testing the Program -Desk Checking -Translation -Debugging Documentation Identifying the Problem PROGRAM LIFE CYCLE
  • 4. Did you know that the first programmed word is “HELLO WORLD” LEVELS OF PROGRAMMING LANGUAGES Machine Language or First Generation Programming Language -this is considered to be the lowest level of programming language. Assembly Language or Second Generation of Programming Language -instead of using 1s and 0s assembly language uses MNEMONIC Codes. Mnemonic codes are abbreviations that easy to remember High Level Language or Third Generation Programming Language -this language transformed programming in the early 1960’s. Very High Level Languages or Fourth Generation Languages -Fourth generation languages (4GL) simplifies further the third level generation languages. Natural Languages - These languages are considered to be the fifth Generation languages. These programming languages are called Natural Languages because of their resemblance to English Language.
  • 5. Procedural Languages Programming languages which are considered procedural that uses a series of instructions or statements which are sequential from the beginning to the end. Examples of Procedural Languages: BASIC – Beginner’s All-Purpose Symbolic Instruction Code COBOL – Common Business Oriented Language PASCAL FORTRAN- Formula Translator C PL1 – Programming Language One
  • 6. Non-procedural Languages These Programming languages are considered as object- oriented programming languages. It is different from procedural language since statements are not executed line per line instead a series of instructions are executed as a whole when an event occurs. Examples of Non-procedural Languages VISUAL BASIC C++ JAVA DELPHI
  • 7. FLOWCHARTING Flowcharting is one of the processes used in designing or planning the solution to a problem. It is a graphical representation to the solution of a problem. It uses shapes to show instructions and arrow lines and heads to display the flow. It uses the shapes OVAL, PARALLELOGRAM, RECTANGLE, DIAMOND,CIRCLE & PENTAGON
  • 8. Oval Terminal Symbol Parallelogram Input/Output Rectangle Process Diamond Decision Hexagon Initialization/Preparation Arrow Lines & Arrow Heads Direction Annotation Circle On Page Connector Pentagon Odd-Page connector
  • 9. Qbasic Tutorial After launching the QBasic interpreter (see before you start), you might see a window requesting a list of "parameters." If this window comes up, press the Enter key to continue. You should now see the QBasic interpreter, which has a blue background and displays a dialog box at the center. (If the interpreter fills the entire screen, then you may want to press "Alt + Enter," to make it smaller.) Press the Esc key to hide the dialog box. QBasic interpreter - main screen
  • 10. Type the following (including the quotation marks) in the QBasic interpreter: PRINT "Hello World!" <press Enter> Now press F5 to run the program. You should now see a black screen, with Hello World at the top, and Press any key to continue at the bottom. Press a key on the keyboard to return to the main screen. (The figure below displays the "output screen.") Basic interpreter - output screen If you run the program again, the interpreter adds another Hello World. QBasic adds Hello World each time the program is run.
  • 11. Deleting the program To erase the current program:Go to the "File" menu. Click "New." The interpreter asks if you want to save the program. Select "No" (or if you'd rather keep the program, select "Yes"). Strings There are certain types of data (or information) called "strings." Strings contain a sequence of characters (letters, numbers, and symbols) enclosed in quotation marks. For example, "Hello World!" is a string. The following are also strings: "0123456789" "This is a string" "abc123" "1 + 1 = 2"
  • 12. Commands There are also special functions called "commands" (also called "instructions"). A "command" tells the QBasic interpreter to do something. The PRINT command tells the QBasic interpreter to print something to the screen. In this case, the interpreter printed"Hello World!". TIP: Instead of typing PRINT, you can enter a question mark. For example: ?"Hello World!" With the PRINT command, you can also print numbers to the screen. Delete the current program (unless you already have) and write the following:PRINT 512 (or ?512) <press Enter> Press F5 to run the program. The program outputs:512
  • 13. More about the PRINT command You can use multiple print statements in your program.PRINT "Hello" PRINT "World" Output:Hello World To place World onto the previous line, place a semi-colon after PRINT "Hello".PRINT "Hello"; PRINT "World" Output:HelloWorld Also, if you put a comma instead of a semi-colon on the first line, the program will insert spaces between the two words.PRINT "Hello", PRINT "World" Output:Hello World
  • 14. Variables This chapter discusses an important topic in programming, "variables." Please read this section thoroughly. A variable is a piece of data kept in the computer's memory (RAM). The location of a variable in RAM is called the"address." How a variable is stored in RAM The following program prints the variable X to the screen:print X Since the variable hasn't been assigned a number, the value of the variable is 0. So, the output of the program is:0 This next program sets X to 15, and then prints the variable: X = 15 print X This time, the output is:15 In the above example, the number 15 was stored in the computer's RAM at a certain memory address. Then the PRINTcommand accessed (or looked at) that address when it printed "15" to the screen.
  • 15. Expressions If you pass an expression to a variable, the expression is evaluated and the variable is set to that value.x = 500 + (10 * 7) PRINT x Output:570 You can also use variables as expressions.rate = 50 time = 2 distance = rate * time PRINT distance Output:100 Plus, you can have both variables and numbers in an expression.X = 100 Y = X * 7 PRINT Y Output:700 TIP: The following increases X by 1: X = X + 1
  • 16. Strings If you add a dollar sign ($) to the end of a variable, the variable is a string.X$ = "Hello World!" PRINT X$ Output:Hello World! If you try to set a string to a non-string variable, an error occurs.X = "Hello World!" The QBasic interpreter says "Type mismatch" when you try to run the above program. A string can be added to the end of an existing variable string.X$ = "Hello" X$ = X$ + "World" PRINT X$ Output:HelloWorld You can also add variable strings together.a$ = "String1" b$ = "String2" c$ = "String3" d$ = a$ + b$ + c$ PRINT d$ Output:String1String2String3
  • 17. Retrieving keyboard input 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 this program is 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 a non-string variable.INPUT number PRINT number If you enter text instead of a number, the QBasic interpreter displays an error message ("Redo from start").
  • 18. To receive a number, use a non-string variable.INPUT number PRINT number If you enter text instead of a number, the QBasic interpreter displays an error message ("Redo from start"). 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 TIP: You can have the question mark displayed on the previous line by using a semi-colon. PRINT "Enter some text:"; INPUT text$
  • 19. 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" Output:x is greater than 5
  • 20. ELSE 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 doesn't equal 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 theIF statement. END IF should appear right after the list of commands.x = 5 IF (x = 5) THEN INPUT a$ PRINT a$
  • 21. END IF The following program uses ELSE with the END IF command:x = 16 IF (x = 5) THEN INPUT a$ PRINT a$ ELSE PRINT x * 2 END IF Output:32 TIP: There is a way to have multiple commands after IF...THENwithout using END IF. To do so, place a colon between each command. IF (x = 5) THEN INPUT a$: PRINT a$
  • 22. THANK YOU FOR INQUIRIES Contact us. https://www.facebook.com/mhonarch https://www.facebook.com/eirelavlavun?fref=ts Or Email us at [email protected]