Program Development C# Programming January 30, 2007 Professor J. Sciame Computer Aided Problem Solving • Steps for Computer Aided Problem Solving: – – – – – Program Analysis and Specification Algorithm Development Program Coding Program Execution and Testing Program Maintenance Program Analysis & Specification • Determine: – Program Input – Program Output • Specification = Input & Output • Problems Encountered – Changing Values – Being too specific Algorithm Development • Algorithm = The formulation of a problem as a detailed sequence of simple steps. • Algorithms are designed using three basic methods of control: – Sequential Control – Selection Control – Repetitive Control Pseudocode • Pseudocode is a mixture natural language and symbols, which include: – – – – – Mathematical Operators Variable Names Comments Keywords Indentation Flowchart • A graphical display of an algorithm. • Uses: – Symbols – Flow lines • Alternate - Top Down Design Program Coding • To express the algorithm in a programming language • Concepts: – Syntax – Variables – Data Types • Readability Program Execution • • • • • • Write the program with the editor Include preprocessor codes Save and compile the program Link the program Load into memory Execute (Run) Errors • Syntax (or Compile Time) • Run Time • Logic Program Maintenance • Responsibilities: – Testing & Validation – Maintenance Software Engineering • The study of the use of the techniques used to solve problems • Systems Analysts - Help in complex problems Memory Concepts • Variable names correspond to locations in memory • All variables have: – – – – a name a type a size a value Memory Concepts II • The statement cin >> integer1 or x = a + b is called a destructive read-in. • The statement cout << x is called a nondestructive read-out Arithmetic Operators • • • • • Addition + Subtraction Multiplication * Division / Modulus % Order of Operations • • • • • Parentheses must be cleared. Exponentiation Multiplication or Division (left to right) Addition or Subtraction (left to right) In nested parentheses, the innermost parentheses are first, working out to the outermost set. Equality and Relational Operators • Equality – (x is equal to y) x = = y – (x is not equal to y) x != y • Relational – – – – (x is greater than y) x > y (x is less than y) x < y (x is greater than or equal to y) x > = y (x is less than or equal to y) x < = y