??. 217 ????????????? CS217 C programming language - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

??. 217 ????????????? CS217 C programming language

Description:

Title: . 217 CS217 C programming language Author: CS Last modified by: Saowalak Created Date: 10/14/2002 7:09:05 AM – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 26
Provided by: cs195
Category:

less

Transcript and Presenter's Notes

Title: ??. 217 ????????????? CS217 C programming language


1
??????????????????????????????????
517 101 LAB - 5_2
2
????????????(operator)
  • ???????????? (operator) ?????????????????????????
    ??????????????????????????? ??????????????????????
    ?
  1. ???????????????????? (assignment operator)
  2. ??????????????????? (arithmetic operators)
  3. ???????????????????? (bitwise operator)
  4. ??????????????????????? (relational operator)
  5. ????????????????????? (logical operator)
  6. ????????????????? (special operator)

6. ????????????????? (special operator)

3
  • ????????????????????????????? ????????
    ??????????????? (operand) ????????????????????????
    ??????????????? 2 ??? ???????????????????????????
    ???????????????????? ????????????????????????????
    ??????????????????????????????

4
???????????????????? (assignment operator)
  • ?????????????????????????????????????????
  • ?????????????????????????????????????????????????
    ???????????
  • ?????? identifier ????????????????????? ???
    expression ?????????????? ??????
    ???????????????????????????????
  • ??????????????? ???????? ??????????????????????
  • ???? x 50

identifier expression
5
???????? ????????????????????????????????
a 3 x y delta 0.001 sum a b area
length width
  • ????????????? ????????????????????? ??????????
  • ???? int i, j, k,cost,fee
  • i j k 100
  • cost fee45

6
??????????????????? (arithmetic operators)
  • ?????????????????????????????????????????????????
    ??????????

7
???????? ??????????????????????????????????
  • 4 3 2
  • 4 6
  • 9 2 - 15/3 7
  • 18 - 5 7
  • 13 7
  • 20

8
?????????????????????
  • -(-5(24-1))((62)58)/4

-(-5(8-1))(858)/4
-(-57)(408)/4
-(2)48/4
-212
10
9
???????????????????????(relational operator)
  • ????????????????????????? (condition statement)
    ???? if
  • ????????????????????????????
  • ?????????????? character string ??????? function
    ?????????string
  • ???????????????????????? ?????????????
    (???????????? 0) ???? ???? (???????????? 1
    ????????????????????????? 0)

???????? ???? C ????????????????? boolean (true
???? false) ??????????????? 0 ?????????????
10
????????????????????????????? c
??????????? operator ???????????????????
???? ????????????????????
  ???????????????????????????? printf(value of
true d , 55) / ?? turbo c
????????? 1 / printf(value of false d,
5!5)
11
  • lt lt gt gt ??????????????????????????????????
    ????????? ????????????????????????????????????????
    ????? ????????????????????????????????????????????
    ???????
  • ! ?????????????????????(equality operator)
    ????????????????????????????????
    ?????????????????????????????????lt lt gt gt
    ???????? ????????????????????????????????????????
    ?????

12
???????? 1
  • ????? i, j ???k ??????????????????????????? 1, 2
    ???3
  • ???????? ?????????????????????????????????????????
    ???????

13
????????????????????? (logical operator)
  • logical operator ??? ????????????????????????????
    ????????????????? ????????????????????? 2
    ???????????????????????? ?????????????????????????
    ??????????? 2 ???? ??? ?????????????????? 1
    ????????????????????? 0 ?????????????????????????
    ??????????(relational operator)
    ???????????????????????? (logical operator)
    ????????

14
????????????????????? (logical operator)
15
??????????????????? operator ???
???????? ?????? operand ??????? 0 ?????? ????
????????????????????? 0 ?????????? ???????? prin
tf(value of (2gt5) (5gt5) d , (2gt5)
(5gt5)) printf(value of (2gt5) (5gt5)
d , (2gt5) (5gt5))
16
????????????????? (special operator)
  • ??? ??????????????????????????????????????????????
    ?
  • ????? ????????????? ??????????????
  • ?????????????????/?? (increment/decrement
    operator)
  • ?????????????????????? (pointer-related
    operators)
  • ?????????????????? (comma operator)
  • ????????????????????? (cast operator)
  • ?????????????????? (sizeof operator)

17
?????????????????/?? (increment/decrement
operator)
  • ??????????????????????????????????????????????????
    ??????????????
  • ????????????????????????????? 2 ?????? ???

18
1. ???????????????? ???? i ???? i--
  • ????????????????? operator ???????????
    ????????? ??????????????????????
  • ???? count 2
  • i count
  • ?????????????????????? count ??????????? i ????
  • ??????????????????????? count ????????????
  • ????? i ???????????? 2
  • count ???????????? 3

19
2. ???????????????? ???? i ???? --i
  • ?????????????????????????????????????????
    ????????? operator ???????
  • ???? count 2
  • i count
  • ????????????????????????? count ????????????
    ??????????????
  • ????????? i
  • ????? i ???????????? 3
  • count ???????????? 3

20
  ?????????????????? (comma
operators)
  • ??????????????????? ????? statement ????????
  • ???????????? int i 5, j 6 , k

21
  ????????????????????? (cast operator)
  • ?????????????????????????????????????????????????
    ??????????????????????????????????
    ?????????????????????????
  • ????????????????????????????????????????????????
    ??????????? ???
  • ???????? type ????????????????????????????????????
    ????? expression ????????????????? ????
    expression ????????????????????????

(type) expression
22
  • float cost3.5
  • int mycost cost / mycost ???????????? 3
    /
  • ??????? ???? c ????????????????????????????????
    ??
  • ??????????????????????????????????????????????????
    ??????
  • casting operator ????
  • i (int) 3.4 6
  • i (int) (3.46)

23
Compound assignments
  • ????????????????????????????????????????
    ?????????????????????
  • ???????????? ????
  • ??????????????????? C ???????????? operator
    ?????????????????? ??????????? compound
    assignments ?????????????????????????????????????
    ?? operator ?????????? compound assignment
    ??????????

int i 5 i i 5 / i ??????? 10 /
??? ???????????????????????? i ??????? 5
????????????????????????????????? i ????????
24
??????????????????? compound assignments
25
???? ????????????????? operator
?????????????????
??????????????????
Write a Comment
User Comments (0)
About PowerShow.com