Тексты на английском
<<  The Material World in 1400 Introduction to Computer Application II  >>
CMP 131 Introduction to Computer Programming
CMP 131 Introduction to Computer Programming
Homework #2 Due Monday March 26
Homework #2 Due Monday March 26
Last Time
Last Time
Today
Today
Special Symbols
Special Symbols
Statements
Statements
General Form of Pascal Programs
General Form of Pascal Programs
Program Structure
Program Structure
Program Structure
Program Structure
Self-Check
Self-Check
General Form of Pascal Programs
General Form of Pascal Programs
Separators vs
Separators vs
One Pascal statement can extend over more than one line More than one
One Pascal statement can extend over more than one line More than one
Use of Blank Spaces
Use of Blank Spaces
Comments
Comments
Self-Check
Self-Check
Program SMALL; VAR X, Y, Z : real; BEGIN Y := 15
Program SMALL; VAR X, Y, Z : real; BEGIN Y := 15
Self-Check
Self-Check
PROGRM p2time5 (input,output); CONST two = 2; five = 5; VAR multip,
PROGRM p2time5 (input,output); CONST two = 2; five = 5; VAR multip,
Pascal Data Types & Expressions
Pascal Data Types & Expressions
Pascal’s Standard Data Types
Pascal’s Standard Data Types
Real Data Types
Real Data Types
Real Data Types
Real Data Types
Self-Check
Self-Check
Ordinal Data Types
Ordinal Data Types

Презентация: «Функция у f x 7 класс». Автор: Violetta Cavalli-Sforza. Файл: «Функция у f x 7 класс.ppt». Размер zip-архива: 45 КБ.

Функция у f x 7 класс

содержание презентации «Функция у f x 7 класс.ppt»
СлайдТекст
1 CMP 131 Introduction to Computer Programming

CMP 131 Introduction to Computer Programming

Violetta Cavalli-Sforza Week 4, Lecture 2

2 Homework #2 Due Monday March 26

Homework #2 Due Monday March 26

a) Textbook pg. 36 (Exercises 1.4): Do exercises 2, 4, 6, 7. b) Textbook pg. 44 (Exercises 1.5): Exercises 8, 13, 16. c) Following the example of calculating the mean that we used in class during Week 3 of the course, develop the problem statement, analysis, and design for a program that calculates the maximum of a set of numbers. You don't know how many numbers you will be given. You can assume that all numbers will be greater than 0.

3 Last Time

Last Time

Started looking at some of the details of the Pascal programming language Syntax graphs for describing legal syntax of various types of constructs constants & literals variables Different kinds of identifiers and conventions for writing them: reserved identifiers standard identifiers user-defined identifiers

4 Today

Today

Homework #2 assigned More programming language details Data types and expressions

5 Special Symbols

Special Symbols

Punctuation and other symbol combinations Usually consists of one or two characters Examples: One character special symbols Punctuation: . , ; : Arithmetic: + - * / Comparison, constant assignment: = Two character special symbols Variable Assignment: := Comparison: <> <= >=

6 Statements

Statements

Executable Statements Statements that appear in the program body, following the reserved word begin. Each executable statement is translated by the compiler into one or more machine language instruction Non-Executable Statements: Statements that are not translated into machine language instructions and don't appear in the object file (declarations, begin-end, comments)

7 General Form of Pascal Programs

General Form of Pascal Programs

program progName ; {Program heading} {Declaration part} const {Constants} constant = value; ... constant = value; type type1 = definition; ... type2 = definition; var {Variables} variable list : type; ... variable list : type; begin {Program body} statement; ... statement end.

8 Program Structure

Program Structure

Program heading: Begins with the reserved word program Tells the compiler the name of the program . Declaration part: Gives names and types of identifiers Informs the compiler to reserve memory cells to them. Program body: Executable statements enclosed in begin-end.

9 Program Structure

Program Structure

Program heading program pname; or program pname (Input, Output); Program body begin statement(s) end.

10 Self-Check

Self-Check

Which of the following are valid program headings? Which are invalid and why? Program program; INVALID using reserved ID program 2ndCourseInCS; INVALID starts with digit program PascalIsFun; program Rainy Day; INVALID – contains space

11 General Form of Pascal Programs

General Form of Pascal Programs

begin & end enclose the program body Semicolons (‘;’) separate statements ‘;’ isn’t needed after begin or before end

12 Separators vs

Separators vs

Terminators

Separator: something that separates other items BEGIN a ; b ; c ; d ; … ; z END Terminator: something that terminates another item BEGIN [a ;] [b ;] [c ;] [d ;] … [z;] END In Pascal, the proper use of ‘ ; ‘ is as a separator, but the compiler accepts it as a terminator.

13 One Pascal statement can extend over more than one line More than one

One Pascal statement can extend over more than one line More than one

statement can be written on one line Writing one statement per line improves the readability & simplifies program maintenance Blankspace is mostly cosmetic. Pascal uses reserved words, punctuation, declarations and known statement types to understand your program.

14 Use of Blank Spaces

Use of Blank Spaces

One or more blanks are considered as one blank Tab is also considered as a blank Blanks may be added to improve appearance of a program Use blank lines between sections of a program A blank is required between words in a program line Leave a blank after comma, before and after operators (*, -, :=, ...).

15 Comments

Comments

Syntax: { comment } {New Pascal versions} or (* comment *) {Older Pascal versions} Part of program documentation Listed in the program but ignored by the Pascal compiler Each program should begin with a header section that consists of a series of comments specifying: Programmer's name and/or identification Date of the current version of the program Brief description of program purpose, use of identifiers, assumptions, prerequisites, . . . etc.

16 Self-Check

Self-Check

Rewrite the following code so that it has no syntax errors and follows the writing conventions we adopted Program SMALL; VAR X, Y, Z : real; BEGIN Y := 15.0; Z := -Y + 3.5; X :=Y + z; writeln (x, Y, z); END.

17 Program SMALL; VAR X, Y, Z : real; BEGIN Y := 15

Program SMALL; VAR X, Y, Z : real; BEGIN Y := 15

0; Z := -Y + 3.5; x := Y + z; writeln (x, Y, z); END.

18 Self-Check

Self-Check

PROGRM 2time5 {input,output}; CONST two := 2; five := 5; VAR multip; dummy ; integer; BEGIN ; multip = two * five ; dummy := multip ; write (two) , write (five) END ;

19 PROGRM p2time5 (input,output); CONST two = 2; five = 5; VAR multip,

PROGRM p2time5 (input,output); CONST two = 2; five = 5; VAR multip,

dummy : integer; BEGIN multip := two * five ; dummy := multip ; write (two) , write (five) END .

20 Pascal Data Types & Expressions

Pascal Data Types & Expressions

21 Pascal’s Standard Data Types

Pascal’s Standard Data Types

Predefined data types real integer char boolean for standard Pascal strings ( added to Turbo Pascal) Data types enable the compiler to know, for each memory cell used in a program how much memory should be reserved which operations are valid The use of compile-time type-checking also allows many errors to be caught at compile-time.

22 Real Data Types

Real Data Types

Floating-point : A number representation consisting of: A mantissa, M An exponent, E An (assumed) radix (or "base") Sign bit. The number represented is M*R^E where R is the radix - usually ten but sometimes 2. Many different representations are used for the mantissa and exponent themselves. The IEEE specify a standard representation which is used by many hardware floating-point systems. Fixed-point: The fixed point of a function, f is any value, x for which f x = x. A function may have any number of fixed points from none (e.g. f x = x+1) to infinitely many (e.g. f x = x). The fixed point combinator, written as either "fix" or "Y" will return the fixed point of a function

23 Real Data Types

Real Data Types

Objects: Variables Constants Literals (i.e. value appearing directly in the program) Operations: Arithmetic: + - * / Assignment: := Standard procedures: ReadLn, WriteLn, Read, Write Examples: Fixed-point Scientific Floating-point 12.345 1.2345 x 10 1.2345E1 12345.6 1.23456 x 104 1.23456E4 0.00012 1.2 x 10-4 1.2E-4 120000.0 1.2 x 105 1.2E5 -123000.0 -1.23 x 10-5 1.23E5

24 Self-Check

Self-Check

Write the following numbers in normal decimal notation: 103E-4 1.2345E+6 123.45E+3 Write the following numbers in Pascal scientific notation 1300 123.45 0.00426

25 Ordinal Data Types

Ordinal Data Types

An ordinal data type is a data type whose values can all be listed The following are ordinal data types integer boolean char Real data type is not ordinal - There are infinitely many real numbers and between any two real numbers there are infinitely many other real numbers

«Функция у f x 7 класс»
http://900igr.net/prezentacija/anglijskij-jazyk/funktsija-u-f-x-7-klass-208287.html
cсылка на страницу

Тексты на английском

46 презентаций о текстах на английском
Урок

Английский язык

29 тем
Слайды