buffer

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

Upload: emerson-sloan

Post on 30-Dec-2015

34 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: buffer

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

Page 2: buffer

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.

Page 3: buffer

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

Page 4: buffer

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

Page 5: buffer

Using the Standard Units in a Program

PROGRAM CleartheScreen;Uses CRT;{clears the screen}BEGIN

ClrScr;END.

Note: If you are using a fast machine, this may produce a division by zero error. In that case you need toinstall a unit called newdelay. If anyone has this problememail me.

Page 6: buffer

The Art of Programming

Top-Down Design

Page 7: buffer

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.

Page 8: buffer

Software Development Method

• Requirements specification

• Analysis

• Design

• Implementation or coding

• Testing

Page 9: buffer

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

Page 10: buffer

Analysis

• Identify input and outputs– What information should the solution provide?– What data do I have to work with?

• Identify data types needed

Page 11: buffer

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)

Page 12: buffer

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