Download
identifiers n.
Skip this Video
Loading SlideShow in 5 Seconds..
Identifiers PowerPoint Presentation
Download Presentation
Identifiers

Identifiers

128 Views Download Presentation
Download Presentation

Identifiers

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Identifiers • Programmer defined names or words. • Naming Rules for identifiers: • alphanumerical • underscore • no leading digit(s) • no space e-business and Information Systems

  2. Identifiers - Examples • Correct: • RowCount • Return2Copies • columncount • ColumnCount • columnCount • Incorrect Names: • 2Copies • row Count • 3rdRow e-business and Information Systems

  3. Basic Concept of Programming • Basic Computer Operations: • Data Inputs • Data Manipulations • Data Outputs e-business and Information Systems

  4. Data Manipulation • Manipulating Data with: • Unknown values • user inputs • depend on the results of other manipulations • Known values – predetermined • Constant values – values will not change thru the execution e-business and Information Systems

  5. RAM Identifiers bFlag bDone iCount Data Storage • Run time storage for unknown value: • Variable – Identifier - Data Storage Reference • names (identifier) • data types (size of the data storage) • scopes (duration or lifetime) e-business and Information Systems

  6. Variable Name • Naming Rules for Variables: • alphanumerical • no leading digit • no space • underscore • Naming Conventions: • lowercase for first character • Uppercase for the character of a word e-business and Information Systems

  7. Variable Name - Examples • Correct Names: • RowCount • Return2Copies • columncount • Preferred: • rowCount • return2Copies • columnCount • Incorrect Names: • 2Copies • row Count • 3rdRow e-business and Information Systems

  8. Data Types • Primitive Data Types: • int • char • float e-business and Information Systems

  9. Define a Variable • Syntax: • Data_Type Variable_name; • Data_Type Variable_name = Value; • Examples: • int iCount; • char iFirstCharacter; • char iC = ‘A’; • int iNumber = 0; • float fFlat = 17.5; e-business and Information Systems

  10. Scope of a Variable • Scopes: • block scope • instance scope – will talk more about this later • class scope – will talk more about this later e-business and Information Systems

  11. Scope - block • Scope: • between the most inner block of {…} • starts right after the definition of the variable e-business and Information Systems

  12. Block Scope - Example { int iTotal; int iSteps; { int iBegin = 0; int iEnd = 10; //data manipulations }//end of scopes of iBegin and iEnd //data manipulations }//end of scopes of iSteps and iTotal e-business and Information Systems

  13. { int iTotal; int iSteps; //data manipulations }//end of scopes of iSteps and iTotal { int iBegin = 0; int iEnd = 10; //data manipulations }//end of scopes of iBegin and iEnd Block Scope Example – cont. e-business and Information Systems

  14. Scope - instance • Instance scope variables: • properties • non-static e-business and Information Systems

  15. Scope - class • Class scope variables • unique for all instances of the same class • static variables e-business and Information Systems

  16. More on Data Manipulations • Basic operations: • value assignment operator = • addition operator + • subtraction operator - • multiplication operator * • division operator / e-business and Information Systems

  17. Simple statements int iBegin = 0; int iEnd = 10; int iSteps; int iTotal; iSteps = iEnd – iBegin; iTotal = 5 * iSteps; //note a complete statement ends with ; e-business and Information Systems

  18. Basic Structures • Structured Programming in C/C++ • sequence • decision/selection/testing • iteration/repetition/looping e-business and Information Systems

  19. Sequence //Do this instruction int iCount = 0; int iRow = 0; int iColumn = 0; e-business and Information Systems

  20. False True Condition if(condition) { //Do Task 2 } else{ //Do Task 1 } Do Task 2 Do Task 1 Decision/Selection/Testing e-business and Information Systems

  21. while (condition) { //Do Tasks } Do Tasks True Condition False Iteration/Repetition/Looping e-business and Information Systems