1 / 11

QBasic

QBasic. Chapter 3 – Fundamental Statements. 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. QBasic Statement Components.

nate
Download Presentation

QBasic

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 400.00 • 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

More Related