introduction to qbasic l.
Download
Skip this Video
Download Presentation
Introduction to Qbasic

Loading in 2 Seconds...

play fullscreen
1 / 42

Introduction to Qbasic - PowerPoint PPT Presentation


  • 476 Views
  • Uploaded on

Introduction to Qbasic. Program Concepts. 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. This lecture.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Introduction to Qbasic' - enan


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introduction to qbasic

Introduction to Qbasic

Program Concepts

readings
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
this lecture
This lecture
  • Computer programs
  • development cycle
  • program planning
  • planning tools
  • variables
    • rules for naming
    • assigning values
programming languages

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

slide5
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

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.

Main Programming Languages
write a program comparison of languages
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
slide8

COBOL

* 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

slide9

C

/* Compute gross amount due

gross = price * qty-purch;

/* compute net amount due

if disc_code = 0

net=gross;

else

{

disc_amt = .02 * gross

net=gross-disc_amt

}

/* Print net amount due

printf{“The net amount due is %d/n”, net};

slide10
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

slide11
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.amount.due

BASIC

slide12

COBOL

C

FORTRAN

BASIC

accessing qbasic
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
later versions of windows
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

in the labs
In the labs
  • K Block
    • start; programs; dos applications; quickbasic
  • Z Block
    • shortcut
important keys
Important keys
  • ALT + enter to maximise screen
  • Ctrl + break to stop a continuously looping program
qbasic window
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
menus
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
program development cycle

Output

Process

Input

Program Development Cycle
  • determine outputs - what is the question?
  • determineinputs - what is the user required to enter/ data available?
  • determineprocess - algorithm / mathematical formulas

algorithm - step by step solution to the problem

steps in planning the program
Steps in Planning the program
  • 5 steps in the planning process
  • ????
program planning
Program Planning
  • Analysis - define the program
  • Design - plan the solution; consider all ‘what if scenarios’
  • Code - translate into (QBasic) language
  • Test and Debug
  • DOCUMENTATION!!!!!
programming tools
Programming Tools
  • Flowcharts
  • Pseudocode
  • Top-down charts
flow charts
Flow charts
  • represents the steps in the algorithm in a graphical manner
your turn
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”
pseudocode
Pseudocode
  • Uses English like phrases with some Qbasic terms to outline the program
  • assign grades:

enter exam mark

if exam >=50 then grade is pass

else grade is fail

print grade

end

top down chart
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
a general solution
Payrate = 6.25

hours = 25

grosspay = payrate * hours

PRINT grosspay

END

A general solution?
variables
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
assignment of variables
X = 0.5

y = 10

z = x + y

total = z + x

y = total

x = 10

x = x+y

Assignment of variables
variable names
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...
valid names
A

4sale

Test1

Rumplestiltskin

%Interest

Gross Pay

Grosspay

GroSSPay

Valid

invalid

valid

valid

invalid

invalid

valid

valid

Valid names
your turn32
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
key points
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
slide34
The End
  • If you wish for an intro to spreadsheets, please stay
slide35
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.
pascal
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.
fortran
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.
slide38
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.
cobol
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.
basic
BASIC
  • Basic: Beginner’s 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
slide41
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
slide42
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