Introduction to Qbasic

Loading...

PPT – Introduction to Qbasic PowerPoint presentation | free to download - id: 13addd-Yjk4M



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Introduction to Qbasic

Description:

'Program Development Cycle' p 28 - 38 Qbasic with an Introduction to Visual Basic ... New development Turbo Pascal' by Borland Corporation. Fortran ... – PowerPoint PPT presentation

Number of Views:3068
Avg rating:3.0/5.0
Slides: 43
Provided by: BRO135
Learn more at: http://www.usq.edu.au

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Introduction to Qbasic


1
Introduction to Qbasic
  • Program Concepts

2
Readings
  • as per Module 7 Study Book
  • Getting Started p 4 - 15
  • Qbasic with an Introduction to Visual Basic by
    Schneider
  • Program Development Cycle p 28 - 38 Qbasic with
    an Introduction to Visual Basic by Schneider

3
This lecture
  • Computer programs
  • development cycle
  • program planning
  • planning tools
  • variables
  • rules for naming
  • assigning values

4
Programming Languages
  • What is a program?
  • It is software
  • A detailed set of instructions to execute a
    specific task
  • performs tasks in the IPOS cycle

5
  • 1957 FORTRAN
  • 1958 ALGOL
  • 1960 LISP
  • 1960 COBOL
  • 1962 APL
  • 1962 SIMULA
  • 1964 BASIC
  • 1964 PL/I
  • 1966 ISWIM
  • 1970 Prolog
  • 1972 C
  • 1975 Pascal
  • 1975 Scheme
  • 1977 OPS5
  • 1978 CSP
  • 1978 FP
  • 1980 dBASE II
  • 1983 Smalltalk-80
  • 1983 Ada
  • 1983 Parlog
  • 1984 Standard ML
  • 1986 C
  • 1986 CLP(R)
  • 1986 Eiffel
  • 1988 CLOS
  • 1988 Mathematica
  • 1988 Oberon
  • 1990 Haskell

6
Main Programming Languages
  • Basic
  • Cobol
  • C, C
  • Fortran
  • Pascal
  • ADA
  • JAVA
  • HTML
  • According to Sammet, over 200 programming
    languages were developed between1952 and 1972,
    but she considered only about 13 of them to be
    significant.

7
Write a program - comparison of languages
  • Program to compute gross amount due on an invoice
  • multiply unit price by quantity of the purchase
    giving the gross amount

8
  • compute net amount due
  • IF discount-code 0
  • move gross-amount to net-amount -due
  • ELSE
  • multiply .02 by gross-amount
  • giving discount-amount
  • subtract discount-amount from gross-amount
  • giving net-amount-due
  • print net amount due
  • move net-amount-due to net-amount-due-out
  • write report-line-out from detail-line
  • after advancing 2 lines

COBOL
9
  • / Compute gross amount due
  • gross price qty-purch
  • / compute net amount due
  • if disc_code 0
  • netgross
  • else
  • disc_amt .02 gross
  • netgross-disc_amt
  • / Print net amount due
  • printfThe net amount due is d/n, net

C
10
  • C Compute gross amount due
  • gross price qty
  • C compute gross net amount due
  • IF (code 0 ) then
  • net gross
  • ELSE
  • disc .02 gross
  • net gross - disc
  • ENDIF
  • C Print net amount due
  • WRITE (CRTOUT.) The net amt due is ,net

FORTRAN
11
  • REM compute gross amt due
  • gross.amount unit.price quantity.purch
  • REM compute net amount due
  • IF discount.code 0 THEN
  • net.amount.due gross.amount
  • ELSE
  • discount .02 gross.amount
  • net.amount.due gross.amount - discount
  • ENDIF
  • REM print net amt due
  • PRINT USING the net amt due is,.net.amo
    unt.due

BASIC
12
COBOL
C


FORTRAN
BASIC
13
Accessing Qbasic
  • Qbasic is part of DOS 5.0 or later
  • Windows 3.11
  • double click the Qbasic icon in Windows
  • double click MSDOS icon in Windows at the DOS
    prompt type Qbasic i.e. c\qbasic
  • Windows 95
  • on master disc/CD-ROM
  • others\oldmsdos\qbasic.exe

14
Later Versions of Windows
  • Windows 98
  • tools\oldmsdos\qbasic.exe
  • You can also download it from the Internet at

http//members.xoom.com/ white_acid/basic/compiler
/ qbasic.zip
15
In the labs
  • K Block
  • start programs dos applications quickbasic
  • Z Block
  • shortcut

16
Important keys
  • ALT enter to maximise screen
  • Ctrl break to stop a continuously looping
    program

17
Qbasic Window
  • Menu Bar - drop down menus for functions
  • File Edit View Search Run Debug Options
    Help
  • Title Bar - name of program currently being
    accessed until initially saved is Untitled
  • ------------------------ Untitled
    -------------------------
  • View Window - window where program is written
  • Immediate Window - used for debugging
  • Status Bar - information on program

18
Menus
  • access to drop down menus by
  • using mouse
  • pressing ALT key highlights shortcut keys e.g. F,
    E, V etc. to menus highlighted letters in menu
    are shortcuts
  • ESC key to return to View Screen
  • become familiar with contents of menus

19
Program Development Cycle
  • determine outputs - what is the question?
  • determine inputs - what is the user required to
    enter/ data available?
  • determine process - algorithm / mathematical
    formulas
  • algorithm - step by step solution to the problem

20
Steps in Planning the program
  • 5 steps in the planning process
  • ????

21
Program Planning
  • Analysis - define the program
  • Design - plan the solution consider all what if
    scenarios
  • Code - translate into (QBasic) language
  • Test and Debug
  • DOCUMENTATION!!!!!

22
Programming Tools
  • Flowcharts
  • Pseudocode
  • Top-down charts

23
Flow charts
  • represents the steps in
    the algorithm in a
    graphical manner

24
Your turn
  • Draw a flow chart that will take an angle entered
    in degrees, convert it to radians and calculate
    the sin, cos and tan of the angle.
  • The syntax for sin cos and tan are not
    necessary. A flow chart is a description of the
    process and does not necessarily contain any
    code

25
Pseudocode
  • Uses English like phrases with some Qbasic terms
    to outline the program
  • assign grades
  • enter exam mark
  • if exam gt50 then grade is pass
  • else grade is fail
  • print grade
  • end

26
Top - Down Chart
  • Hierarchy chart
  • show overall structure of program
  • show organisation of program but omit the
    specific processing
  • describe what each module does and how modules
    relate
  • used for larger programs - Assignment 5
  • may combine top down charts and flow charts

27
A general solution?
  • Payrate 6.25
  • hours 25
  • grosspay payrate hours
  • PRINT grosspay
  • END

28
Variables
  • Quantities referred to by symbolic names
  • make general solutions
  • Variable name is the name of a storage location
    in primary memory where Qbasic stores the value
    of the variable
  • value can change during program execution

29
Assignment of variables
  • X 0.5
  • y 10
  • z x y
  • total z x
  • y total
  • x 10
  • x xy

30
Variable names
  • may only contain letters, digits and full stop
  • may not contain a blank space
  • must start with a letter and may be up to 40
    characters
  • may NOT be a reserved word e.g let, print
  • generally given a value of 0 initially but...

31
Valid names
  • A
  • 4sale
  • Test1
  • Rumplestiltskin
  • Interest
  • Gross Pay
  • Grosspay
  • GroSSPay
  • Valid
  • invalid
  • valid
  • valid
  • invalid
  • invalid
  • valid
  • valid

32
Your turn
  • Draw a flowchart that take two times in hours,
    minutes and seconds and will calculate the total
    time in hours minutes and seconds e.g 2 hr, 15
    min 12 sec 1 hr 10 min and 5 sec 3 hrs 25
    min and 17 sec

33
Key points
  • how to access Qbasic
  • menu system
  • save and retrieve a program
  • program development cycle
  • software development cycle
  • programming tools
  • flowchart pseudocode top down charts

34
  • The End
  • If you wish for an intro to spreadsheets, please
    stay

35
ADA
  • ADA Named by Augusta Ada Byron, Countess of
    Lovelace, a mathematician in the 1800 who wrote
    the first computer program. ADA is based on
    Pascal and is supported to the US Department of
    Defence and requires its use on all US government
    military projects. The language is portable
    allowing transfer between computers.

36
Pascal
  • Pascal Developed in Switzerland in 1968, named
    after Blaise Pascal who developed one of the
    earliest calculating machines. Developed for
    teaching programming and was one of the first
    programming languages where the instructions in
    the language were designed to encourage
    programmers to follow a structured program. New
    development Turbo Pascal by Borland Corporation.

37
Fortran
  • Fortran FORmular TRANslator developed by IBM in
    1957. Designed to be used to scientists,
    engineers and mathematicians considered to be
    the first high level language noted for its
    capability to easily express and efficiently
    calculate mathematical equations.

38
C
  • C Developed in 1972 by Dennis Ritchie at Bell
    Laboratories originally designed as a
    programming language for writing systems software
    but now general purpose language very powerful
    UNIX operating system is written in C.

39
Cobol
  • Cobol COmmon Business Orientated Language. Key
    person in development was Admiral Grace Hopper in
    1960. Development was backed by US Department of
    Defence. COBOL instructions are arranged in
    sentences and grouped into paragraphs produces
    lengthy program code very good for processing
    large files and simple business calculations.

40
BASIC
  • Basic Beginners All-purpose Symbolic
    Instruction Code. Developed by John Kenneny and
    Thomas Kurtz in 1964. Designed to be simple
    interactive programming language for college
    students. Other versions include Microsoft
    Quickbasic, GWbasic, Qbasic etc

41
Java
  • Similar to c and c
  • developed for multimedia on Web
  • creates small program called applets which are
    downloaded and run on your browser
  • safe from virsus
  • simple robust and portable
  • object orientated
  • developed by Sun MicroSystems
  • JavaScript simplier version developed by Netscape

42
HTML
  • Hyper Text Markup Language
  • not strictly a programming language but does have
    specific syntax rules
  • used for WWW - formating language to layout web
    pages with text graphics video and sound