Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3 – Fundamental Statements

Similar presentations


Presentation on theme: "Chapter 3 – Fundamental Statements"— Presentation transcript:

1 Chapter 3 – Fundamental Statements
QBasic Chapter 3 – Fundamental Statements

2 QBasic Statement Components
Keywords Constants Numeric constants Real numbers – include decimal points Integers – w/out decimal points No commas, symbols (only – sign) or blank spaces Exponential notation is used

3 QBasic Statement Components
Constants Character string constants Alphanumeric data Only one set of double quotes Length of a string – max 32,767 characters Variables Can only store one value at a time Referred to by addresses Variables are named Only first 40 characters are recognized in QBasic QBasic does not differentiate between upper & lowercase Use descriptive variable names

4 QBasic Statement Components
Numeric Variables Supplied by the programmer or Calculated during program execution Begins with a letter, followed by letters, digits, and periods Cannot have blank spaces

5 QBasic Statement Components
String Variables Stores character strings Begins with a letter followed by letters or digits and always end with a $ Keywords Cannot be used as variable names READ, LIST, PRINT, LET and END

6 Simple QBasic Statements
CLS – Clear Screen Documenting a Program REM Single quotation mark (‘) Can be used anywhere in the program REM **** This program was created by *** ‘ This program was created by

7 Simple QBasic Statements
Assigning Values to Variables Assignment Statement LET keyword is optional LET Rate = .0825 LET Tuition = 50.00 Heading$ = “Inventory Report” Classification = 4

8 Simple QBasic Statements
Arithmetic Operations Composed of numeric constants, numeric variables, and arithmetic operators +, -, /, *, ^ LET Tuition = Hours * 50 Order of Operations - PEMDAS

9 Simple QBasic Statements
Displaying Results PRINT PRINT Heading$, Tuition would result in: Your tuition amount is Displaying Literals Group of characters containing just about anything PRINT “JUNK $%^ 4567” would result in: JUNK $%^ 4567

10 Simple QBasic Statements
END Stops program execution Immediate Window Execute statements as soon as ENTER is pressed

11 Simple QBasic Statements
HELP F1 key or HELP menu Highlight menu option & then press F1 or right mouse button Press ESC to close HELP screen Alt-H for list of HELP topics Smart Editor


Download ppt "Chapter 3 – Fundamental Statements"

Similar presentations


Ads by Google