????? 6 TURBO PASCAL - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

????? 6 TURBO PASCAL

Description:

... PROGRAM, ... defined identifier ... – PowerPoint PPT presentation

Number of Views:74
Avg rating:3.0/5.0
Slides: 27
Provided by: 5436
Category:

less

Transcript and Presenter's Notes

Title: ????? 6 TURBO PASCAL


1
????? 6TURBO PASCAL
  • OUTLINE
  • 1. ??????????????????????????????????????
  • 2. ???????????? (Data type)
  • 3. ???????????? ??? ?????? (Operator and
    Expression)
  • 4. ????????????????????? (Input/Output
    command)
  • 5. ???????????? (Control Statement)

2
????? 1TURBO PASCAL
  • TURBO PASCAL
  • ????????? Dr. Niklaus Writh ?.?. 2514
  • ????????????????????????????????????/???????
  • ???????????????????
  • ??????????????? ?? BEGIN ..END

3
??????????????
  • 1. ?????? (reserved word ???? key word)
  • ????????????????????????? ???????????????????????
    ???? PROGRAM, BEGIN,END IF
  • 2. ????????? (standard identifiers)
  • ??????????????????????????????
    ???????????????????????????? ??????????
    ??????????? 5 ?????? ???

4
??????????????
  • Predefine type identifier ????????????????????????
    ???? ???? integer ,word, boolean, byte, real,
    char
  • Predefine constant identifier ???????????????????
    ? ???? pi, true, false, maxint, nil
  • Predefine procedure identifier ???????????????????
    ?????????????? ???? clscr, readln, move ,reset,
    delete

5
??????????????
  • Predefine variable identifier ????????????????????
    ??? ???? mem, port, input, output, randseed
  • Predefine function identifier ????????????????????
    ????????????? ???? upcase, random, sqrt, chr,
    ord, succ, readkey

6
??????????????
  • 3. ??????????????????? (user-defined identifier)
    ??????????????????????? ???? ???????????
    ?????????? ????????????? ??????????????
    ????????????

7
IDENTIFIER
  • ??????????????
  • ?????????????????????????????????????????????????
    ???
  • ?????? ????????? ?????????????????????????????????
    ????????????????????????
  • user-defined ????????????????????????????????????
    ????????????????????????

8
???????????????????????????
  • 1. ?????????????????????????????
  • 2. ???????????????????????? ???????? ????
    ???????
  • 3. ???????????????? ????????
  • 4. ???????????????????????????????????????????
    ????
  • INDEX, Index, inDEX
  • 5. ????????????????????? ?????? 63 ??????
    (Version 4.0)
  • 6. ?????????????????????

9
???????????????????????????
  • Identifier ??????????
  • RESULT
  • A500
  • NUM_OF_STUDENT
  • MAXRATE
  • CIRCLE
  • Identifier ??????
  • ROOM.07
  • 1ABC
  • BRGIN
  • STOCK
  • PAC MAN

10
???????????????????????????
  • 1. ( ) ???? ????????????????
    ???????????????????????
  • 2. ????????????? ????????????????????????
    ????????????? ?????????????????
  • 3. ???????????????????????????????????????????
    ??
  • 4. . ????????????????????????????????????????????
    ?????
  • 5. ( ) , ??? ???????????????? - /

11
???????????????????
  • ??????????????????????? 3 ???????????
  • ??????? (Heading) ??????????? PROGRAM
  • ???????????????? (Declaration part)???????????????
    ???????????? ??????????? ??????????????????
    (Subprogram)
  • ?????????? (Statement part)???????????????????????
    ????? BEGIN- END

12
???????????????????
HEADING ???????
  • PROGRAM program name (INPUT,OUTPUT)
  • TYPE var type
  • CONST var1 value
  • VAR var2,var3 variable type
  • PROCEDURE ???? FUNCTION
  • BEGIN
  • STATEMENT (S)
  • END.

DECLARATION PART ????????????????
Statement Part ??????????
13
HEADING
  • ??????
  • PROGRAM program name
    (INPUT,OUTPUT,FILE)
  • ???????????????????? PROGRAM
  • ??????????????????????????????????????????????
  • ??????????????????????? ??????????????????????????
    ??????? ???? INPUT ?????????????? ???????
    ????????? OUTPUT ????????????? FILE
    ????????????????????????????????????

14
HEADING
  • ????????
  • PROGRAM payroll
  • PROGRAM tax (input, output)
  • program score (input,output, scorefile)

15
DECLARATION PART
  • ??????
  • TYPE var type
  • CONST var1 value
  • VAR var2,var3 variable
    type
  • ?????????????????????????????????
    ???????????????? BEGIN-END
  • ??????????????????????????????????????????????????
    ??????????

16
DECLARATION PART
  • ??????????????????????????? 4 ???? ????
    ????????????????????? ??? ????????????????????????
    ??????????
  • ?????????????????????? ????? CONST
    ?????????????????
  • ???????????????????????????? TYPE
    ?????????????????
  • ????????????????????? VAR ?????????????????
  • ??????????????? ???????? PROCEDURE ???? FUNCTION
    ???????????

17
??????????????????????
  • ??????????????????????????????????????
    ????????????????????? ???? ??????? ?????????????
    ?????????? ???? ???pi

18
??????????????????????????
  • program tax
  • uses wincrt
  • const rate 0.07
  • var itemcost,saletax real
  • begin
  • write('Please enter cost of item')
  • readln(itemcost)
  • saletax rate itemcost
  • writeln('Itemcost is
    ',itemcost62)
  • writeln('Sales tax is
    ',saletax62)
  • end.

19
??????????????????????
  • Typed Constant
  • CONST
  • MAX RATE 0.07
  • STOP CHAR
  • PASSWORD STRING4 DANG
  • ?????????????????????? ?? 2 ??????Untype Constant
    ??? Typed Constant
  • Untype Constant
  • CONST
  • MAX 100
  • RATE 0.07

20
??????????????????????
  • ?????????????????????????????????????
    ??????????????????????????????????? ????
  • pi ????? 3.1415926536E00 (real)
  • false ????????????? (Boolean)
  • true ????????????? (Boolean)
  • maxint ????? 32767 (Integer)

21
???????????????????????? (TYPE)
  • ??????
  • TYPE identifier type
  • ???????????????????????????????
    ???????????????????????????????? ???? integer,
    real,char,string
  • identifier ?????????????????????

22
????????????????????????????
  • TYPE
  • day mon,tue,wed,thu,fri,sat,sun)
  • customer RECORD
  • name string30
  • age integer
  • end
  • Maxstring string80
  • namelist ARRAY 1..100 of string 30

23
???????????????? ( VAR)
  • ??????
  • VAR identifier, identifier
    type
  • ?????????????????????????????? (Variable)
  • ????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ?????
  • ????????????? Assign ??? ???? ??????? (Readln)
    ???????????????????

24
???????????????????????? ( VAR)
  • VAR
  • result,subtotal real
  • I,j,k integer
  • name string 30
  • grade char
  • flag Boolean
  • buffer array 1..128 of byte

25
???????????????
  • ??????????????? ??????????????????????????????????
  • ????????????????????????????????????????????????
    ??????????
  • ????????????????????? ???? PROCEDURE ????
    FUNCTION
  • ?????? END
  • ??????????????????????????????????????

26
??????????
  • ??????????? BEGIN ?? ???? END.
  • ???????????????????????????
  • ?????????????????????????????????
    ????????????????????????????????????????
Write a Comment
User Comments (0)
About PowerShow.com