. 217 CS217 C programming language - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

. 217 CS217 C programming language

Description:

????????????????? (Naming Variable) ???????????????????????? (Naming Variable) ????????????????????? (Arithmatic) ?????? C. ???????????????. 3 ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 25
Provided by: cs195
Category:

less

Transcript and Presenter's Notes

Title: . 217 CS217 C programming language


1
517 101 LAB 6-1
2
1. ?????? (variable)
  • ??????????????????????????????????????
  • ????????????????? (Naming Variable)
  • ???????????????????????? (Naming Variable)
  • ????????????????????? (Arithmatic) ?????? C
  • ???????????????

3
????????????????? (Naming Variable)
  • ????????? ?????? C ?????????????????
    ???????????? Case-Sensitive (?????????????????????
    ??????????????
  • ?????????????)
  • ???? main( ) ????????????? Main(
    ) ??? MAIN( )

4
???????????????????????? (Naming Variable)
  • ????????????????????????????????, ??????
    ?????????????? _ ????????
  • ?????????????????????? ???????? ???? _
    ??????????????????????????????????
  • ???????????????????? 32 ????????
  • ??????????????????? (Reserved Word) ?????? C ????
    int , for, do, printf ???

5
????????????????????? (Arithmatic)
6
???????????????
  • ?????? C ?????????????????? ? ??????????? ???
    block (???? ) ???? ?????? block ???????????
    function ?????????????????????
    ???????????????????????? ???????????? ?
    ??????????? ??? block
  • ????????????????????????

?????????? ??????????
???? ?????? i ??????????? int ????? int i
?????? realnum ????????????? float
????? float realnum
7
???????????????????????????
  • ????????????????????????????? ????????????????????
    ???????? ??????(statement) ???????? ????????????
  • 1. ???????????????? ????
  • int i
  • int j
  • int k
  • 2. ???????????????????????? ???? int i, j,
    k

8
??????????????????????????????????
  • ?????? C ?????? (statement) ??????????????????
    ??????????????????????????????????????????
  • ????????????
  • ???? int i 5

?????????? ?????????? ???????????
  • ???????????????????????? ????? ???????????????????
  • ?????????
  • ???? int i 5, k 3, y

9
?????????????????????
  • ????????? (statement) ?????? C
    ?????????????????????
  • ?????? (statement) ??????????????????????????????
    ?? ???? int x
  • ???? if (z gt b) printf(d,z)
    ????????
  • ???????????????????????? ?? ???? C
  • ????????????????????????????????????????????
    ????????????
  • ?????????? ?????????? ?????????? ...
    ????????????


10
??????????? function ??????? printf()
  • printf() ????????????????????????????????????????
    ?
  • ??????????? stdio.h ??????????????????????????
    include
  • ???? stdio.h ?????????????????????????
  • ???? include ltstdio.hgt

11
  • ???????????? printf()
  • 1. ????????????????????
  • printf("Character_string")
  • ???? printf("Hello World!")
  • 2. ???????????????????????
  • printf("Format_string", ??????)
  • ???? printf(d,9999)

12
printf("Format_string", ??????)
  • Format_string
  • 1. ??????????????????????
  • ???? printf(Your age is d,age)
  • 2. Escape Sequence
  • ??? ?????????????????????????
    (??????????????????? \ )
  • ???? printf(Your age is \n)
  • 3. Format Specification
  • ???????????????????????????????(????????????????
    ??? )
  • ???? printf(Your age is d,age)

13
????????????
14
2. Escape Sequence
15
3. Format Specification
Escape Sequence
16
??????????????????
  • 1. ????????
  • ???? printf(d,1234)
  • 2. ???????????
  • ???? printf(d,i)
  • 3. ?????????????????
  • ???? printf(d, 235)
  • 4. ?????? return ??? function
  • ???? printf(d, abs(-5))

17
???????????????????? ??????????????
18
???????? (Constant)
  • ???????? ??? ???????????????????????????????????
    run ???????
  • ????????????????????
  • ???? 547, -1234, 4000000
  • ???????????????? ????????????????????????
  • ???? a, Z, ,
  • ????????????????????
  • ???? 12.456, -0.314, 1.23e01, 456.78e-10,
    4567.5E5
  • ???????? ??????????????????? (string)
  • ????????????????????????
  • ???? C Language, 1234 , Hello Hi"

19
???????????????????? ??? ????????????????????
  • ?????????????????????? 2 ????
  • 1. ??? const
  • const lt????????????gt lt????????????gt
    lt????????gt
  • ???? const int MAXBOUND 15
  • 2. ??? define

20
???????????? ?????????????????? main()
???????????? define ????
  • define PI 3.1414
  • define MAXVALUE 50
  • main()
  • const float RATE 1.5
  • .

21
????????????????
  • ??? ???????????????????????????? ????????
  • ???? a, Z, , , \n
  • ????????????????? ????????????????
  • char myChar A

22
???????????????????????
  • char ????????????? ??????????????? ?????????
    -127 ??? 128
  • ?????????????????????? char
  • ???? ??????????? a
  • char ch a / ch ?????????
    97 /
  • char myChar A / myChar ????????? 65 /

1. printf(d, myChar) ????????????
?2.printf(c, myChar) ???????????? ?
23
??????????????????? (Character String)
  • ??????????????????? ?????????????????????????????
    ?????
  • ???? Pay, Give me ???????
  • char myChar g,i,v,i,n,g,
    ,m,e,\0

????????????????? ???????????????????
24
??????????????????????????
  • char ????????????? ??????????????? ????????? -127
    ??? 128
  • ??? Character Array ??????????????????????????
    (character string)

?????? (array) ??? ??????????????????????????????
???????????????????????? ????????????????????????
??? (element) ???????? ????? ?????????????
(subscript ???? index) ???????????????????
?????????? C ??????????????????????? 0
????????????????????? ??????
???? char arr15
?????????? ???????????????????????
Write a Comment
User Comments (0)
About PowerShow.com