1 / 13

Qbasic

Qbasic. Input, Calculations and Functions. The INPUT statement. INPUT variable-list INPUT “ prompt ” ; or , variable-list prompt – any valid string ; – Question mark generated , – No Question mark generated variable-list – mix and match separate with commas.

janice
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 Input, Calculations and Functions

  2. The INPUT statement • INPUT variable-listINPUT “prompt ” ; or , variable-list • prompt – any valid string • ; – Question mark generated • , – No Question mark generated • variable-list – mix and match separate with commas

  3. DATA & READ statements • DATA const, const, const, … • Provides internal storage • Accessed sequentially • READ var, var, var, … • Populates variables from DATA • RESTORE label • Resets the some or all the DATA

  4. Calculations • Order of operations (precedence) • ^ (Power) • +, - (Unary) • *, /, \, MOD, +, - (Arithmetic) • <, <=, >, >=, <>, = (Relational) • Boolean operators • NOT, AND, OR, XOR, EQV, IMP

  5. Boolean Operators • NOT – negation (bit-wise complement) • AND – logical addition (conjunction) • OR – logical subtraction (disjunction) • XOR – exclusive “or” • EQV – logical equivalence • IMP – logical implication

  6. NOT Boolean Truth Tables NOT True False False True

  7. AND Boolean Truth Tables AND True True True False True False False True False False False False

  8. OR Boolean Truth Tables OR True True True True True False False True True False False False

  9. XOR Boolean Truth Tables XOR True True False True True False False True True False False False

  10. Arithmetic Operators • * – Multiplication • / – Division • \ – Integer Division • MOD – Modula (remainder) • + – Addition • - – Subtraction

  11. Functions • A function is a set of instructions that perform a specific task. • FunctionName (argument1, …) • Built-in & User defined X$ = UCASE$(X$)

  12. Built-in Functions • Mathematic • SQR, EXP, LOG • Trigonometric • SIN, COS, TAN • String • RIGHT$, LEFT$, MID$

  13. Built-in Functions • Conversions • MKI$ - CVI, MKD$ - CVD • CHR$ - ASC • System • DATE$ - TIME$

More Related