Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.

Similar presentations


Presentation on theme: "1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs."— Presentation transcript:

1 1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs

2 2 © 2000 John Urrutia. All rights reserved. Program Development Problem definition – statement  Who – The person, group, organization  What – The record, file, system, data  When – The timeframe  Where – The location  Why – The business reason

3 3 © 2000 John Urrutia. All rights reserved. Program Development Problem definition - decomposition  Data  Input – what are the data sources.  Output – what are the data sinks.  Process  Detailed description of how the Input is manipulated into Output.

4 4 © 2000 John Urrutia. All rights reserved. Program Development Program design – Algorithm  Sequence – linear execution of instructions  Selection – Identify a processing path  Binary  Case  Iteration – repetitive execution of instructions

5 5 © 2000 John Urrutia. All rights reserved. Program Development Program design – Flowcharts  A graphical representation of the problem definition Process Decision Termination Manual Screen

6 6 © 2000 John Urrutia. All rights reserved. Program Development Program design – Pseudocode  An English-like representation of the problem definition  IF the meat is green Then move it to the waste bucket Else move it to the good bucket

7 7 © 2000 John Urrutia. All rights reserved. Program Development Implementation – coding The syntactical exercise of converting the program design into a specific programming language.

8 8 © 2000 John Urrutia. All rights reserved. Program Development V&V –Verification & Validation  Specification errors  Syntax errors  Logic errors

9 9 © 2000 John Urrutia. All rights reserved. Program Development Documentation  Program - internal  User - external

10 10 © 2000 John Urrutia. All rights reserved. B. A. S. I. C. Beginners All-purpose Symbolic Instruction Code QBasic – QuickBASIC

11 11 © 2000 John Urrutia. All rights reserved. Qbasic Character Set Letters: a-z and A-Z Digits: 0-9 Blank: the space character ( ) Special characters: + - * / \ =., ’ ” ( ) : ; ^ _ $ # ? ! % &

12 12 © 2000 John Urrutia. All rights reserved. Qbasic Keywords A keyword has a predefined meaning within Qbasic.  Examples: LET END REM PRINT

13 13 © 2000 John Urrutia. All rights reserved. Qbasic Data Types All data in Qbasic is identified by a data type  Numbers  % – Integer -32,768 to 32,767  & – Long integer -2,147,483,648 to 2,147,483,647  ! – Single precision 7 digit ( 10 38)  # – Double precision 15 digit ( 10 308)

14 14 © 2000 John Urrutia. All rights reserved. Qbasic Data Types  Strings:  Any set of characters enclosed in double quotation marks.  “ ”  Maximum of 14,656 Characters

15 15 © 2000 John Urrutia. All rights reserved. Constants & Variables Constants  “literal” values that cannot be changed  No label Variables  Value can be changed  Referenced by a label

16 16 © 2000 John Urrutia. All rights reserved. Labels A name assigned to represent a variable.  Must start with a letter Should be meaningful. Can have periods imbedded. Should carry the data type.

17 17 © 2000 John Urrutia. All rights reserved. The LET statement Assigns a value to a variable. Can be Explicit or Implicit LET variable.Name = value LET my.nbr! = 0 LET my.str$ = “This is my string” LET tot! = tot! + purchases! + taxes!

18 18 © 2000 John Urrutia. All rights reserved. The PRINT statement Writes information to the terminal. PRINT output-list PRINT X$ PRINT 5 + 7 PRINT “Hello World” PRINT (prints a blank line)

19 19 © 2000 John Urrutia. All rights reserved. The END statement END terminates execution Closes any open files. Not required but highly recommended.

20 20 © 2000 John Urrutia. All rights reserved. The CLS statement CLear Screen  Erases all characters from the terminal  Places cursor at position 0,0 (top left corner)

21 21 © 2000 John Urrutia. All rights reserved. The REM statement The REM ark statement  Treats everything to the right as a comment.  ‘ – Is short hand for the REM

22 22 © 2000 John Urrutia. All rights reserved. SPACE$(), SPC() and TAB() SPACE$(n)  Returns a string of n spaces SPC(n) – skips n spaces TAB(n) – specifies an exact column

23 23 © 2000 John Urrutia. All rights reserved. The PRINT USING statement Writes formatted data to the teminal PRINT USING “ format-string ” ; output-list The format-string specifies  Numeric edited data formats  String formats  Literal data

24 24 © 2000 John Urrutia. All rights reserved. USING format characters Strings  \n\ – first n +2 characters in the string  ! – first character in the string  & – no formatting  _ – print character not format

25 25 © 2000 John Urrutia. All rights reserved. USING format characters Numbers  # – number digit . – decimal point , – thousands separator  + – sign of number  - – trailing minus sign  $ $$ – fixed / floating dollar sign


Download ppt "1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs."

Similar presentations


Ads by Google