5d803a8e281e2b35d49d07c5db21d989.ppt
- Количество слайдов: 12
buffer • Whenever a read or readln is executed and you type a line of data terminated by hitting ENTER, that line, along with the CR/LF end of line marker is stored as characters in a series of memory locations called the input buffer. – Remember CR and LF are stored as two separate characters
Pointer • While data is in the buffer, the program keeps track of the location it will read the next data item from. • After read is used to read data, the pointer points to the character immediately to the right of the last character used. • Readln sets the pointer to the first character in the next line.
Using Units • Unit: A group of compiled procedures, along with the definitions and declarations they use. • Standard Units: Predefined units that come with the Turbo Pascal compiler
Standard Units • Crt: screen and keyboard procedures • DOS: allows use of DOS commands in program • System: (automatically included) standard functions and procedure • Printer: printer functions and procedures • Overlay, Graph: we will not use
Using the Standard Units in a Program PROGRAM Clearthe. Screen; Uses CRT; {clears the screen} BEGIN Clr. Scr; END. Note: If you are using a fast machine, this may produce a division by zero error. In that case you need to install a unit called newdelay. If anyone has this problem email me.
The Art of Programming Top-Down Design
The Art of Problem Solving • The art of problem solving is the transformation of an English description of a problem into a form that permits a mechanical solution. • A straightforward example of this process is transforming an algebra word problem into a set of algebraic equations that can then be solved for the unknowns.
Software Development Method • • • Requirements specification Analysis Design Implementation or coding Testing
Requirements Specification • State the problem and gain a clear understanding of what is required for the solution. – Sounds easy but can be most difficult part – Must define the problem precisely • eliminate unimportant aspects • zero in on root problem
Analysis • Identify input and outputs – What information should the solution provide? – What data do I have to work with? • Identify data types needed
Design • Develop a list of steps to solve the problem. This is called an algorithm. – First list the major steps of the problem that need to be solved (subproblems) – Now attack each of the subproblems. This is call refining the algorithm. (this process is like divide and conquer)
Implementation or Coding • Notice that until now the steps are the same regardless of the programming language you are using. • Translate your algorithm from pseudocode to Pascal. – Good programming style – comments
5d803a8e281e2b35d49d07c5db21d989.ppt