??? C?????? - PowerPoint PPT Presentation

1 / 64
About This Presentation
Title:

??? C??????

Description:

Title: PowerPoint Author: KIM Last modified by * Created Date: 2/28/2001 3:22:30 AM Document presentation format: Other titles – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 65
Provided by: KIM1327
Category:
Tags: bcpl | powerpoint

less

Transcript and Presenter's Notes

Title: ??? C??????


1
??? C??????
  • ??(????????????????)
  • ??(????????)
  • ??????
  • ??????
  • C????

2
1.1 ?????
  • ?????????,???0?1??????
  • ????????
  • ????
  • ?????
  • ????????

3
1.1 ?????(?)
  • ????????????
  • 10??????2?8?16???
  • ?????????
  • ?????????
  • 2?8?16??????10???
  • ?????
  • 2??????16???
  • ?????16?????
  • 16??????2???
  • ?????2?????

4
1.1 ?????(?)
  • ????????
  • ?????
  • ??????,?????????????,???????????
  • ?????
  • ??????,??????????????????????,?????????????

5
1.1 ?????(?)
  • ????????
  • ?????
  • ???????????????1,?????????????
  • ???????????????
  • ?????
  • ???????
  • ????????????
  • ??????

6
  • ????????
  • ? ??????????????,????
  • ????????????,??????(0
  • ?1?),??????????????
  • ?8??? 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
  • - 8??? 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    0
  • 0??? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • - 0??? 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0
  • ? ????????????,???????
  • ?????,?????????
  • ?- 8??? 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
  • - 0??? 1 1 1 1 1 1 1 1 1 1 1 1
    1 1 1 1

7
  • ? ??????????,????????
  • ???1
  • ?- 8??? 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
  • - 0??? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0
  • 0??? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  • ? ???????,0???????
  • ????????????
  • ????????????? ?
  • 1111 1111 1111 1101 (-3)???
  • 0000 0000 0000 0001 (1)???
  • 1111 1111 1111 1110 (-2)???

8
  • ?216??
  • ???16??????????,??????
  • ????00000000000000001111111111111111
  • 0 216 -1 ?
    065535
  • ????10000000000000000111111111111111
  • -215 215 -1 ?
    -3276832767
  • ?????????????????16???,
  • ??????16?????,??
  • 65534 3 655361 ???
    ???
  • 1111 1111 1111 1110 (65534)
    (-2)
  • 0000 0000 0000 0011 (3)
    (3)
  • 1 0000 0000 0000 0001 (1)
    (1)

9

  • ??? ???
  • 1000 0000 0000 0010
    (32770)(-32766 )
  • 1111 1111 1111 1101 (65533)(-3)
  • 1 0111 1111 1111 1111
    (32767)(32767)
  • ??? 3277065533 6553632767
  • ??? -32766-3 -32769 -6553632767
  • ????????a?b?216???(?)???
  • ???(???????????16?????),
  • ????????????????,??????
  • ??????????216??,?????????
  • ??65536???????

10
1.1 ?????(?)
  • ?216??
  • ??????a?b,???????n,???? a b
    216n,?????????????16??????,???????a?b????????????
    ,??a?b?216???(?)??????,????????????????,??????????
    ??????216??,???????????65536???????

11
  • ??????????????????????-3276832767?????,???????n??
    ???????,????????n??????????327671?????-32768,327
    672?????-32767?

12
????????????
  • ??????????????
  • ???????????????????????
  • ?? int a8,b-8

??? 0?? 1??
???
???
??
a81010002
b- 810-10002
0 0000000 00001000
1 0000000 00001000
??
1 1111111 11110111
0 0000000 00001000
1 1111111 11111000
??
?????????? ?????????????????
?????,???????,???1?
13
????????????
  • ???????????????
  • ?????????????????????,?????,?????????????????
    ??????
  • (110.011)B1.1001121011001.1 2-10 0.110011
    211
  • ? N????2????
  • ???????????
  • ???????????

????? 0?? 1??
0 110011 0 11
14
1.1 ?????(?)
  • ??????????
  • ???????????
  • ???????????
  • ?????????????????,??????,??????????
  • ????????????,?????????????????,??????
  • ?????????????????,???????????????????,????????????
    ?,????????????????????

15
1.2 ?????????
  • ????????????
  • ????????????
  • ???????????????
  • ??????????8????
  • ???32?????????,??16?????????
  • ??????,???????????,????,???????,????????????,???
    0??,??????????

16
1.2 ????????? (?)
  • ??????????
  • ?????????,???????????????,????,???????????????,?
    ???????,???????,??????????????,???????????????,?
    ??????,????????,??????????
  • ?????????????????????,?????????????????,?????????
    ???

17
1.2 ?????????(?)
  • 16??????????

18
1.2 ?????????(?)
  • ???????????
  • ?????

19
1.2 ?????????(?)
  • ????????
  • ?????????,????????
  • ? ?????????????????????
  • ? ?????????????
  • ? ?????????????????????
  • ? ??????????????
  • ? ??????????????????
  • ? ??????????????

20
1.2 ?????????(?)
  • ????????
  • ???????????????
  • ? ???????????????????????
  • ? ??????????????
  • ? ?????????????????????
  • ? ???????????,?????????????
  • ? ?????????????

21
1.3 ???????
  • ?????????
  • ?? ?? ????
  • ????????????
  • ?????????????????
  • ??
  • ????????????????????

22
1.3 ??????? (?)
  • ?????
  • ?????
  • ????????????
  • ??????????????????
  • ??????
  • ??????????????????

23
1.3 ??????? (?)
  • ?????
  • ???????
  • 1) ????
  • 2) ?????
  • 3) N-S??????
  • 4) ???
  • ?
  • ??????????????
  • 1) ????
  • 2) ????
  • 3) ????

24
?????????????? 1) ???? ?????
N-S???
??
A
B
A
B
??
??A?B????,????????????
25
??????N-S?????? ?????????????????? N-S??????
???????,??? ?????????,??????????
26
2) ????(????) ?????
N-S???
?? ??
P P
A B
T F
P
T F
B
A
??P??????? A?B????????????
A?B???????,?? ???
27
??N-S???????x?y?????
xgty? T F x?max y?max
??????s????,?????PASS??
sgt60? T F ??"PASS" ?
slt60? T F ? ??"PASS"
28
??a?b?c????
??a?b?c altb? a ? t b ? a ? t
? a altc? a?c ? bltc? b ? c
? ??a?b?c
T
F
F
T
T
F
29
??????????????
?? k1 k2
kn



??
K
A1
A2
An
??K???????? Ai????????????
30
3) ???? ??????????,??????????
?? F
T

?P?? A
P
A
??
??P??????? A?????????,?????
31

???????????,???????
??
F T

A ??P??
A
P
??
??P??????? A?????????,?????
32
???? ???5! (12345)
1?t
1?i
?i5 ti?t i1?i
?? t
1?t
2?i
ti?t i1?i ?? igt5
?? t
???? ?????
33
3x - 11 ( 0 x lt 10) y 2x 5
(10 x lt 20 ) x (20 x
lt 30)
??? x?y??
??x
F
?? x



x0xlt30
x0xlt30 T
F
T
xlt10
??X??
xlt10 T F
T
F
T
? ? x ? ?
xlt20
xlt20 T F
3x-11?y
F
yx
y 3x-11
y 2x5
x?y
2x5?y
?? y
??y
34
???????????
w ????
??????
??n w0, i2 ksqrt(n) iltk w0
ni0? w1 i
w0? ??"Yes" ??"No"
??
?? ??
Y F
Y F
35
  • ????
  • ????????????????????????????
  • 2) ???????????????????
  • ??????
  • 3) ??????????????

36
1.3 ??????? (?)
  • ???????
  • ??????????????,???????????,???????????????????

37
1.4 C????
  • ???????
  • ?????
  • ??????????
  • ?????????????????
  • 2. ????????
  • ???????????????????
  • ????????
  • ???????????????????
  • ??????
  • ????????????????,??
  • ???

38
  • ??????????
  • ??????????????
  • ???????????
  • ???????,?????????????????????????
  • ???????????????,???????????????????!
  • ????
  • ??????????????????????
  • ?????????,???????????????
  • ??????????????
  • ?????????????????????????????????????
  • ?????????

39
?????????????
CPU????,?0?1?????????? ?10000000 ?
10010000 ?
????????,??????? ??????????? ????????????????
???????????? ? ADD A, B
??????????,???????
40
1.4 C???? (?)
  • C???????

41
Ada
Modula-2
Pascal
ALGOL60
ALGOL68
C
B
CPL
BCPL
C
Smalltalk 80
Java
Simula 67
QBASIC
VB
ANSI-BASIC
BASIC
FORTRAN90
FORTRAN
FORTRAN77
PL/1
COBOL
LISP
PROLOG
42
  • C?????
  • ?????????????
  • ???32?????9?????????
  • ??????????

32????(?????,????????) auto break
case char const continue default
do double else enum
extern float for goto if
int long
register return short signed
sizeof static struct switch
typedef unsigned union void volatile
while
43
9????? if( )else for( ) while( ) dowhile(
) continue break switch goto return
44
? C???Pascal???? C?? Pascal??
??
BEGIN.END
???? if(e) s IF(e) THEN s
???? int i
VAR iINTEGER
??i????? int a10 VAR aARRAY1..10 OF
INTEGER ??????a int f() FUNCTION
f()INTEGER ??f???????? int
p VAR p?INTEGER
??p?????????? i 2 ii2
??i2?i i,i ii1
i??? ??C? Pascal??,?????
45
2. ????? 34????,??????????
????? - / -- ?????lt lt gt
gt ! ?????! ???? ltlt gtgt
????? ???? ?????? ?????, ????? ????
sizeof ??????(??) ?????. -gt ????? ??
( ) -
46
3. ?????? ??????????????????????????????????
47
4. ????????? ????????????????,??? ????????????
???????? 5. ????????,????????????????? 6.
?????,???????,?????? 7. ????????????????? 8.
????(?????)
48
??C???? ?1.2 /?????/ main( )
int a , b , sum /????/ a123
b456 sum a b printf (Sum is
d\n, sum) Sum in 579

49
?1.3 ??????? main( )
int a , b , c scanf
(d,d, a, b) cmax(a , b)
/???????max / printf (maxd\n, c)
int max(int x , int y)
/?????/ int z if (xgty) zx
else zy return(z)

50
?????????? main( ) int a
, b , c scanf (d,d, a, b)
if (agtb) ca else cb printf
(maxd\n, c)
51
??a?b?c?d?????? main( )
int a , b , c , d , m
scanf (d,d,dd, a, b, c, d) m
max(a , b) m max(m, c)
/????????/ m max(m, d)
printf (maxd\n, m) int max(int x
, int y) /????????/ int z
if (xgty) zx else zy
return(z)
52
??????????x2? include
"math.h" main( ) double x, y, z
printf("Please input x")
scanf (lf, x) ypow(x, 2)
/??????/ zsqrt(x) printf
(yf, zf\n, y, z) Please input
x 25? y625.000000, z5.000000
53
??C???? 1.??C???????????????main?????????main???
???? 2. ?????C??????? 3. ????????????????????????
? 4. ????? ???(????) ????
???? ??? ????

54
5. ??C????
????? include ????? main() ????
scanf(d,a) ?????
while(alt10) a ?????,??exit(0) ??1 ???
??
??? ?????? ??1 ??
?? ?? ?????,??
???? ????
55
  • ????
  • ???????,?????
  • ?????,??????
  • ????????
  • ?????????

main( ) int i , j , sum
sum0 for(i1 ilt10i)
for(j1jlt10j)
sumij
printf(d\n,sum)
  • ??????????
  • ??TAB??
  • ??
  • ??????
  • ??????

56
int imain()for(i"ltii)--i"read('-'-'-'
,i"hell\ o, world!\n",'/'/'/'))read(j,i,p)w
rite(j/pp,i---j,i/i)
1984 ??? C ???????? ??????????
57
/ example1.2 calculate the sum of a and
b/ include ltstdio.hgt / This is the main
program / main() int a,b,sum
a10 b24 sumadd(a,b)
printf(sum d\n",sum) / This function
calculates the sum of x and y / int add(int
x,int y) int z zxy return(z)
???? sum34
58
  • ????
  • ??????
  • ????????????
  • ????????????main()
  • ?????main??,?main???,???????????????
  • ????
  • C???????
  • ????????
  • ??
  • / /???,????
  • ???????

? /This is the main / of example1.1/ /
  • ???????

59
1.5 C??????
  • ??????????????

60
1.6 ????????
  • ?????

61
? ? ? ?
62
?????
  • ?????????
  • ?2???
  • 1929 1 (??)
  • 924 1
  • 422 0
  • 221 0
  • 120 1 (??)
  • (19)10(10011)2
  • ??????????
  • ?16???
  • 999916624 15
  • 62416 39 0
  • 3916 2 7
  • 216 0 2
  • (9999)10(270F)16

63
?????
  • ?????????
  • ?2???
  • 0.6875 ? 2 1.375
  • 0.375 ? 2 0.75
  • 0.75 ? 2 1.5
  • 0.5 ? 2 1.0
  • (0.6875)10(0.1011)2

????????? ?8??? 0.6875 ? 8 5.5 0.5 ? 8
4.0 (0.6875)10(0.54)8
64
?????
  • ?????????
  • (11010.01)2
  • 1?24 1?23 0?22 1?210?20 0?2-1 1?2-2
  • 16 8 0 2 0 0
    0.25
  • 26.25
  • ??????????
  • (2C3D)16
  • 2?163 12?162 3?16113?160
  • 2?409612?2563?1613
  • 819230724813
  • 11325
Write a Comment
User Comments (0)
About PowerShow.com