SlideServe
Menu
Préférences
© SlideServe · v2026

Comprehensive Guide to Programming Variables, Data, and Instructions

alika avatar
7 diapositives · 181 Views · Sep 05, 2014

Explore the world of programming with detailed information on variables, data types, declarations, assignment statements, and more. Learn how to store, manipulate, and output data effectively in various programming languages.

Comprehensive Guide to Programming Variables, Data, and Instructions - slide 1
01 / 7Comprehensive Guide to Programming Variables, Data, and Instructions
1 / 17

Télécharger la présentation

Comprehensive Guide to Programming Variables, Data, and Instructions
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Program Statements …. ….. Data Values …. ….. • Computer Memory • Programs • Objects and object properties • Instructions • 1. Input • 2. assign values to memory • 3. Calculate • 4. compare and select • 5. repeat a section of code • 6. output • Data – Values of Variables (and constants) • All these must be stored as a particular type of data

  2. Types of Variables currency string (text) integer single (Single precision floating point) (decimal number) double (double precision floating point) (bigger decimal number) boolean (true or false) etc. (see page 62) Declaring Variables: Objects on the form don’t have to be declared (They are already defined!) All Variables (other than Objects) will need to be declared: Dim Taxes as currency Dim CustomerID as integer, CustName as string Always use “option explicit” statement in “general code” section.

  3. Variable Types and Variable Declaration Variable Types Single, double, currency, integer, long, date, boolean, string Declaration statements (Dim) Option Explicit and setting the “require variable declaration” property in tools/options Code Windows and the General Code Window The “Scope” of variable declaration Suggestion: define all variables in the General Code Window Constants and declaring constants (Const) Example: Declare a variable in the code for command button click, then use that variable in code for a different command button click.

  4. Assignment statements Variable = Expression NetPay = RegularPay + OverTimePay Answer = 6 + 2 / 2 ^ 2 + 1 Expressions (arithmetic, logical) Order of operations [(), ^, -, *, /, \, Mod, +, -] Parentheses Functions – Val(), Str(), Format(variable, “currency”), CCur() IsNumeric()

  5. Code Windows The Object List General Form objects on the form (labels, text boxes, etc.) The Event List Click Double Click Load (for the Form) Key Press Got Focus

  6. Counters In the Initialization Code (Perhaps in the Form Load Event)(executed once): NumberOfEmployeesProcessed = 0 - In the Loop Code (executed repeatedly): - - GrossPay = RegularPay + OverTimePay - NumberOfEmployeesProcessed = NumberOfEmployeesProcessed + 1

  7. Counters and Sums In the Initialization Code (Perhaps in the Form Load Event)(executed once): NumberOfEmployeesProcessed = 0 TotalPayroll = 0 - In the Loop Code (executed repeatedly): - - GrossPay = RegularPay + OverTimePay - NumberOfEmployeesProcessed = NumberOfEmployeesProcessed + 1 TotalPayroll = TotalPayroll + GrossPay