( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

Size: px
Start display at page:

Download "( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)"

Transcription

1

2 ( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023) : http: / /www. cqup. com. cn : fxk@cqup. com. cn ( ) * : /16 :24 : : ISBN :30. 00,,,

3 ( )

4 ,,,,,,,, 21,, ;, ;,, 1

5 2, : 1.,,, 2., ; ;, 3.,,,,, 4.,,,,,, :, ;, ;, ;,,,,,,

6 ,, C, C,,,, :,,, C 1

7 2 ; C,, C ; C,, C ; C C + + Java C# C, C, C 3 : 1 2 C, C C, C 3 C, C C, C ASCII,, :, 1 9 ;, 4 ;, 6 7 ;, 2 3 ;, 5 8 ;,,,, :, xiongz@ cqu. edu. cn, xiongz@ cqcnc. com

8 ( 1) ( 1) ( 2) 1. 2 ( 3) ( 4) ( 4) ( 7) ( 8) 1 ( 12) 2. 1 C ( 13) 2. 2 C ( 15) C ( 15) C ( 17) 2. 3 C ( 17) C ( 17) C ( 20) 2. 4 ( 25)

9 ( 25) ( 26) ( 27) ( 28) ( 30) sizeof ( 31) 2. 5 ( 32) ( 32) ( 33) ( 33) 2. 6 C ( 34) C ( 34) C 7 ( 36) C ( 38) ( 38) 2. 7 ( 45) 2 ( 48) 3. 1 C ( 52) 3. 2 C ( 53) ( 53) ( 54) 3. 3 ( 57) ( 57) C ( 58) 3. 4 ( 73) ( 73) while ( 74) do while ( 75) for ( 77) ( 80) ( 81) ( 84) 3. 5 ( 85) goto ( 85) break ( 86) continue ( 88)

10 3. 6 ( 90) ( 90) ( 97) 3. 7 ( 105) ( 105) ( 106) ( 107) ( 108) ( 109) ( 109) ( 110) 3 ( 111) 4. 1 ( 116) ( 116) C ( 117) 4. 2 ( 118) ( 118) ( 121) ( 123) ( 126) 4. 3 ( 128) 4. 4 ( 133) 4. 5 ( 137) ( 138) ( 140) ( 144) 4. 6 C ( 147) ( 147) ( 148) ( 149) ( 150) ( 151) ( 156) 4 ( 157) 3

11 5. 1 ( 165) ( 165) ( 167) 5. 2 ( 174) ( 174) ( 176) 5. 3 ( 177) ( 178) ( 180) 5. 4 ( 181) 5. 5 ( 182) 5 ( 183) ( 188) ( 188) ( 190) ( 196) ( 197) ( 200) ( 207) ( 211) ( 219) 6. 2 ( 224) ( 224) ( 225) ( 227) ( 234) ( 237) 6. 3 ( 241) ( 241) ( 242) typedef ( 246) ( 247) ( 249)

12 ( 251) 6. 4 ( 254) ( 254) ( 255) 6. 5 ( 259) ( 259) ( 260) 6 ( 262) 7. 1 ( 265) ( 265) ( 266) 7. 2 ( 268) ( 268) ( 269) ( 270) ( 271) ( 271) ( 272) ( 273) 7. 3 ( 273) 7. 4 ( 277) ( 277) ( 279) 7 ( 280) ( 282) ( 282) ( 282) ( 284) 8. 2 ( 285) ( 285) ( 287) 8. 3 ( 287) ( 287)

13 ( 294) ( 296) ( 297) 8. 4 ( 301) ( 301) ( 303) 8. 5 ( 304) ferror ( 304) clearerr ( 305) 8 ( 305) ( 310) C ( 310) ( 314) ( 327) ( 332) 9. 2 ( 339) ( 339) ( 342) ( 344) ( 346) ( 348) ( 350) 9. 3 ( 352) ( 352) ( 354) 9. 4 ( 356) C ( 356) C ( 357) C ( 368) 9 ( 372)

14 ,,,,,,, 1 ),,,,,,

15 ,, :, ;, 2 ) 2,,,,,,,,,,,,,, 3 ), Fortran C,, ; C + + Smalltalk,,, :,,,, ,,,

16 2 :,,,,, ,,,, :, ( Nikiklaus Wirth) : = +

17 , 3,, ;, ;,, ( ),,,,, 2 :,, ( ),, 3, ( ),, ; ;,, C,, C ;,, ),,,,

18 ,, : 1 ; 2 : 2 a b; 3 a > b, a b ;, b a ; 4 2 ) 5,, : sinx = x - x 3 3! + x5 5! - x 7 7! + x9 9! -,, (, 10-5 ),,,,, 5,, : 1 ; 2 0 n( n 0 ) ; 3 n + 1 n( n 1) ; 4 3 ; 5,,,, :,,, 0,, ; 5

19 ,,, 3 ) 6,,, 3, 3, 3 : ( ), :,,, 1. 2 ( ),, 1. 2, : ( ) 2, , :,,

20 ,,, ( ), A3 0 B A3 0 B,,,, 3 : N S ( ) 1 ), ( 1. 5 ), ( ),, ) N S N S Nassi Shneiderman2,,, N S N S

21 3 ) 8 N S,,,,,,,, 3 : ( 1) S1 S2 ( 2) If( ) then 1 Else 2 ( 3) Switch( ) 1: S1 2: S2 n: Sn ( 4) While( ) ( ) 5 ) Do ( ) While( ) 3,, ,,

22 1. 1 r h ( 1) :,, ( 2) : SF - 01 r h 3. 14* r* r* h / a b,, 2 ( 1) :, a b a* b < 0 ( 2) : SF a b If( a* b < 0 ) then Else S S ( a* b) 1 / 2 S ( a + b) / ( 1) : : ; 400 : 2, ( 2) : SF - 03 year If( ( year MOD 400 = 0) ( year MOD 4 = 0) ( year MOD 100 0) ) then Else year year : MOD ( ) x y z, ( 1) : x y x; y z, y > z y ; y < z z x ( 2) : SF

23 10 x y z 3 If( x < y) then x y If( y > z) then Else y If( x > z) then Else 1. 5 z x ( 1) : ( 1 7 ), ( 2) : SF - 05 w Switch ( w) w = 1: " Monday" w = 2: " Tuesday" w = 3: " Wednesday" w = 4: " Thursday" w = 5: : " Friday" w = 6: " Saturday" w = 7: " Sunday" 1. 6 n, n! ( 1) :, 1 : 1 n ; ( 2) : SF - 06 n k < - 0 p < - 1 While( k < n) k < - k + 1 p = p* k

24 n! p 1. 7,, ( 1) :, 2 : ; :, ; ; ; : 10 ( 10 ), ; ;, ( 2) : SF - 07 n s < - 0( 0) Do m < - n MOD 10 s < - s* 10 + m n < - n /10( n 10 n) While( n > 0 ) s 1. 8 : 5, 4, ,? ( 1) : x, y, z : x + y + z = x + 3y z = 100 x : 1 19 y : 1 33 z : z = x - y ( 2) : SF - 08

25 x < - 1 y < - 1 While( x < 19) While( y < 33) z = x - y If( 5* x + 3* y + z /3 = 100) then x y z y < - y + 1 x < - x , ; a 1 x + b 1 y = c 1 a 2 x + b 2 y = c , A( x 1, x 2,, x n ) n R n, A O( 0, 0,, 0), n 1. 5 A m n, , 36, 4, 3, 2 1,? 1. 7, : , : 1 ) 1000, ; 2 ) 2000, ; 3 ) 3000, ; 4 ) 5000, ; 1. 9 :, ( - 1 ),, 9

26 C 2. 1 C 13 C,,, ( ), C C, Martin Richards BCPL( Basic Combined Programming Language) 20 70, Ken Thompsom BCPL, B ( BCPL ) PDP-7 UNIX, PDP-11 UNIX, Dennis. M. Ritchie Vrian. W. Kernighan B, 1972 C ( BCPL ), 20 80, ( ANSI) C C, ANSI C ( 1989 ) C, C,,, C : C, C 32, 9

27 14,, C C, ( bit),, C, C, C,,, C C C : ( ),, C C, 34, + - * / ( &&) ( ) (! ), ( &) ( ) ( ) ( ^) ( < <, > > ), = - = * = / = C, C C, C, ( UNIX MS-DOS Windows ) C,,, C,, C Microsoft C Turbo C Borland C,, C ( ), C 2. 2 C C,

28 C C 2 C , / * * / / * main * / { float ave, x, y, z; /* * / scanf( % f, % f, % f, &x, &y, &z) ; /* scanf * / ave = ( x + y + z) /3; / * * / printf( % f, ave) ; / * printf * /, main, C, main; { 4 C ; scanf C, ; printf C, / * * / 2. 2, : main, myputc, myputc,,,, / * ex2-2. cpp * / #define SIZE 80 / * ( SIZE) ( SIZE) * / { void myputc( char ch) ; / * myputc * / char str[ SIZE] ; / * ( str) * / int j; / * ( j) * / gets( str) ; / * gets * / for( j = 0 ; str[ j]! = \0 ; j + + ) myputc( str[ j] ) ; / * myputc* / void myputc( char ch) / * myputc* / { char cc; cc = ( ch > = a && ch < = z )? ch + A - a : ch; putchar( cc) ; 15

29 16 main myputc, myputc C,,, C : : C ; C : ( ) C main( ) : C main( ),, ( include ), ;,, ;, : C,, \ C, C /, / ( : scanf( ) printf( ) getchar( ) putchar( ) ) / * * /,, C : C, C C,, ( ; ) C,, C ( ), C, C C,,, C : : (, ) : void myputc( char ch) : { ;

30 C ; C 3 : ( main( ) ) C,,, 2. 3 C C,,,,,,,, 17 1 ) C, C 91 : a, b, c,, z A, B, C,, Z 0, 1, 2, 3,, 9 _ ( ) * & %! < >., ; : /? { [ ] ^ : C 32 ( ),, C, C ( ) :

31 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 union unsigned void volatile while 18, C,, : define undef include ifdef ifndef endif line error elif pragma C,, ;, :, ( Turbo C 1 32 ) C,,, C, total TO- TAL ToTaL total C, ( ),, name / xm( ) sex/ xb( ) age /nl( ) salary /gz( ) : a b1 file_name _buf : 5 c int up. to file name. 2 ) C, C,,, C C

32 C C, 2. 1,,,, 3 ), C,, 2. 1 C, C 3 :,,,,, 2. 2 SIZE,,, C,,,, :, : [ ] [, 2 ] ; ;, float. radius, length, area ; : : ( int float char ) ; : 19

33 C 1 ) 20 ( 1) C, 3 : : 0 888, - 123, 0, : 0, 0777, : 0x, 0x123, 0xff ( 2) C : 4, int short long unsigned int C,,,, 2. 1 IBM-PC 2. 1 IBM-PC ( 16 ) int short int long int l unsigned int u char A : l L ; u : ; : int a, b; / * a, b * / long x, y; / * x, y * / unsigned c, d; / * c, d * / 2. 3 { int x;

34 C long y; unsigend z; x = 888; y = 0x7ffa; z = 65535; printf( % d, % ld, % u \ n, x, y, z) ; : 888, 32762, ) ( 1), C,, : : 3 : :, e E 3 : < > E( e) < > : : : : 1. 23e ; e E E - 4 ; e3 2. 1e3. 5. e3 e 4, , 7 ( 2) C, float double 6 7, 4, 8, , 8 : float double ; ; : float x, y; / * x, y * / 2. 4 double z; / * z * / { 21

35 float x1, x2; double y1, y2; x1 = ; x2 = ; y1 = ; y2 = ; printf( % f, % lf\ n, x1 + x2, y1 + y2) ; : , ,,, 3 ) 22 ( 1) C 2 :, a? A \,, ( \ ) ASCII ( ) ( ), : \ r \ n \ 123 \ x C 2. 2 C \0 NULL \ b \ n \r \ f \ t \ \ \ \ \0oo o \xhh h 1, ASCII,

36 C, ASCII ( 2) 1, 1 : char ; : char ch; / * ch * / : C, 2. 5 { int a; char b; a = 1; b = A ; printf( % c \n, b + a) ; : B ( 3) C,,, : Hello, World! a 1,, : abcd \ t123 \ n \ \ \ , : abcdefg abcdefg : + 1, ASCII, NULL, NULL ASCII 0, \ 0 CHINA : 23 C H I N A \ : a,, ; 1

37 , ( a \0 ) 2 4 ) 24 C,, ( ), : #define : #define PI #define EOF - 1 C,,, : ;,,, ; 5 ) C,, : [ ] [ = ] [, 2 [ = 2 ] ] ; : float radius = 2. 5, length = 6. 5, area ; int a = 3, b = 5; char c = a ;, c a ASCII 2. 5 : { int a = 1; char b = A ; printf( % c \n, b + a) ;

38 C , ( ),,,,,,,, C, C : ( + - * / % ) ; ( > > = < < = = =! = ) ; ( &&! ) ; ( = ) ; ( & ^ < < > > ) ; (? : ) ; (, ) ; ( * &) ; ( sizeof) ; ; 1 (. - > ) ; 12 ( [ ] ) ; 13 ( ) C C,,,,,, 25

39 C 15, ( ) [ ] - >. 2! * & sizeof 3 * / % < < > > 6 < < = > > = 7 = =! = 8 & 9 ^ && 12 13?: 14 = + = - = * = / = % = & = ^= = > > = < < = 15,,,, C,, 5 + x - 1, x + -,, x +, 5 + x, -, x = y = 5, y =,, y =, = x C :, + -

40 C, 5 : + - * / %, :, : 7 /5 = 1, - 7 /5 = - 1,, : 7% 5 = 2, - 7 % 5 = - 2, 7% - 5 = 2 C C, : a* b / c a, a + b % 6 :, ( ) * / % =, : x = 10 : 10 x ; y = x + 1 : x + 1, y ( ) : = : : a = 3 b = a c = b = a = 3 :,, ( ) C, : a = ( b = 5 ), b = 5, 5 a = ( b = 5) a = 5, a 5, { int m, n, k; m = ( n = 4) + ( k = 10-7) ;

41 printf( m = % d \n, m) ; : m = 7,,, : j, j = 5. 5 j 5; x, x = 5 x ;, 8 : num float, 2. 5, num = ( int) num, num? ) C, =,, : = : a X = b ( X + - * / % ) : = ( ) a = a X b : x + = 3 /* x = x + 3* / y* = x + 6 /* y = y* ( x + 6), y = y* x + 6 * / x % = y - 5 /* x = y% ( y - 5) * /,, C,, : + = - = * = / = % = < < = > > = & = ^= = 10, 5 : 2. 7 { + = - = * = / = % =

42 C int a = 3, b = 9, c = - 7; a + = b; c + = b; b + = ( a + c) ; printf( a = % d, b = % d, c = % d \ n, a, b, c) ; a + = b = c; printf( a = % d, b = % d, c = % d \ n, a, b, c) ; a = b = c; printf( a = % d, b = % d, c = % d \ n, a, b, c) ; : a = 12, b = 23, c = 2 2 ) a = 14, b = 2, c = 2 a = 2, b = 2, c = ,, 2 : ( , + + i - - i), ( , i + + i { int j = 10, k; printf( j = % d \ t, j) ; printf( j + + = % d \ n, j + + ) ; printf( j = % d \ t, j) ; printf( + + j = % d \ n, + + j) ; : j = 10 j + + = 10 j = j = 12 C, : - ), : i k, i = 3, 29

43 i = 3 k = ( i + + ) + ( i ++ ) + ( i + + ) k 9 i ++ : i, i 1 k = = 9 i = 3 k = ( + + i) + ( ++ i) + ( + + i) k i: 1, i 3 i 1, i 6 k = = 18 30, ( ), i j, ( i + + ) + j : C,,, ( i + + ) + ( i + + ) + ( i + + ), : { int m, n, i = 3, j = 3; m = i i i + + ; /* m < * / n = + + j + ( + + j) + ( + + j) ; /* n < * / printf( % d \n, m) ; /* : 9 * / printf( % d \n, n) ; /* : 18 * / { int i = 3, j = 3; printf( % d \n, i i i + + ) ; / * : * / printf( % d \n, + + j + ( + + j) + ( + + j) ) ; / * : * / C :, :

44 C 1, 2,, n, C, : int i, j; i = 3; j = ( + + i, i + +, i + +, + + i) ; i 7, j 7 { x = 1; y = ( 1, 2, 3, 4) ; z = ( z = 2, z* 5, z + 3 ) ; : x 1, y 4, z 5 a * a = 3 * 5, a * 4 = 60: a = 3 * 5, a = 15; 4 = 60, = 60 ( a = 3 * 5, a * 4), a + 5 = 20 : a = 3 * 5, a = 15; a * 4 = 60; a + 5 = 20, = 20 C,,,,, for, 2. 9 { int x, y, z; x = 1, 2, 3, 4; y = ( 1, 2, 3, 4) ; z = ( z = 2, z* 5, z + 3) ; printf( x = % d, y = % d, z = % d \ n, x, y, z) ; : x = 1, y = 4, z = sizeof sizeof C,, x, sizeof( x) sizeof( int) 2 sizeof,,, sizeof( double), sizeof( ) C, sizeof 2. 10

45 { printf( int: % d \ n, sizeof( int) ) ; printf( short: % d \ n, sizeof( short) ) ; printf( long: % d \ n, sizeof( long) ) ; printf( unsigned: % d \n, sizeof( unsigned) ) ; printf( unsigned short: % d \ n, sizeof( unsigned short) ) ; printf( unsigned long: % d \n, sizeof( unsigned long) ) ; printf( char: % d \ n, sizeof( char) ) ; printf( unsigned char: % d \ n, sizeof( unsigned char) ) ; printf( float: % d \n, sizeof( float) ) ; printf( double: % d \n, sizeof( double) ) ; C,,, C, : Char < int < unsigned < long < float < double char short, int ; float, double ;, { int a, b, c, d, e; float f;

46 C a = 3; b = 5; c = 2; d = a + + ; printf( a = % d, d = % d \n, a, d) ; a = 3; e = + + a; printf( a = % d, e = % d \ n, a, e) ; f = b / c; e = b% c; printf( f = % f, e = % d \ n, f, e) ; : a = 4, d = 3 a = 4, e = 4 f = , e = 1, C : , ( ), :,, { char c = a ; int j = 3, k; float x = 5. 0; k = ( x* j) + ( c + j) ; printf( % d, % f \n, k, ( x* j) + ( c + j) ) ; : 115,

47 C, ( ) : ( ) < > :, :, { int k = 5, n, m; float x = 1. 2; m = ( int) x* k; n = ( int) ( x* k) ; printf( x = % f, m = % d, n = % d \n, x, m, n) ; : x = 1. 2, m = 5, n = C C, 2 : C 5 1 ) C, C,, ;, : ; :

48 C x = y + z; / * ( ) * / y + z; / *,, * / i + + ; / * 1, i 1* / 3 : : : y = x + 1; ; = ; ; : ( ) ;,, : printf( Hello, World! \ n ) ;, ; ( ), : while( getchar( )! ; = \r ) : 35 2 ), C 9, 3 : : if switch : do while while for : break goto continue return 3 ) C {,, : { x = y + z; a = b + c; printf( % d% d, x, a) ; ;,

49 ,, : { char ch; ch = getchar( ) ; putchar( ch) ; C 7 36,,, C,,,, ( Nikiklaus Wirth) : + =,,,, ,,,,, ( ), 3 :, ;, ;,

50 C,,,, : ( 1),,,,,, ( ) ( 2),,, ;,,,,, ( 3),,, ( 4),,,,, ( 5),,,, : ;, ;,, ;, ; ( 6),, ;, 37

51 ,,,, ( 7),,, : ; ;, ; ; ; C 38, C, C,, Turbo C Turbo C ( 2. 4 ) : : DOS : C: \ TC > TC < CR > Windows : : < F3 > < F10 > File Load : < F10 > File New : C : < F2 > < F10 > File Save < CR > < CR > : < F9 > Compile /MakeEXEfile < CR > < F6 >, : < Ctrl - F9 > Run Run : < Alt - F5 > Run User Screen 2. 4 Turbo C : < Alt - X > < F10 > File Quit C S : Turbo C + + IDE

52 C ,, C, I / O I / O stdio. h, I / O, : #include stdio. h 4 : printf scanf getchar poutchar 1 ) printf printf, : printf(, ) ; : ( ) : 3,, %, : % [ ] [ ] [ ] [ * ] : :, printf 39 d o x u f e g c s ( ) ( O) ( Ox) % f% e

53 40 :, % 5d 5 m. n, m, 1, n, % 5. 2f 5, 2,, 0,, 0, printf( % 05d \ n, 88 ) ; : :, ;, : l( long), ; h ( short), * : * { int i = 5, j = 6; printf( % d, % 0 * d \ n, i, i, j) ; : 5, { char c; int a = 88 ; float b = ; c = b ; printf( % d, % 04d, % - 04d, % x, % c \n, a, a, a, a, a) ; printf( % c, % d \ n, c, c) ; printf( % f, % 6. 3f \n, b, b) ; printf( % s \ n, abcdefghijk ) ; printf( % s\ n, abcdefghijk ) ; : 88, 0088, 88, 58, X

54 C b, , abcdefghijk abcd 7 a, % 04 d 4, a 88 0 % - 04d 4,, a 88 % x a, % c a, a 88, ASCII 88 X 8 c, % d c, b ASCII 9 b, % 6. 3d b, 3, b , 2, 0 11 % s\ n abcdefghijk, 4, { printf( 10 : 60 = > 8 : % o \ n, 60) ; / * * / printf( 8 : 074 = > 10 : % d \ n, 074 ) ; / * * / printf( : % d \ n, 622) ; /* 10 * / printf( : % d \ n, - 622) ; /* 10 * / printf( 10 : 116 = > 16 : % x \n, 116) ; / * * / printf( 16 : 0X74 = > 10 : % d \ n, 0X74) ; / * 16 0x * / : 10 : 60 = > 8 : 74 8 : 074 = > 10 : 60 : 622 : : 116 = > 16 : : 0X74 = > 10 : ) scanf scnaf : scanf(, ) ;

55 42 : ( ) : 2,, &, x, &x x : %, % [ * ] [ ] [ ] : :, : l( long), ; h( short), * :, : scanf( % 4d% * 3d% f, &j, &p ) ; , j = 1234, p = 8. 9 :, scanf d o x u f e c s ( ), 2 : 1, ; 2, scanf : scanf, ( ) :

56 C scanf( % 5d, &a) ; a, scanf( % 4d% 4d, &a, &b) ; : a, 5678 b scanf,,, TAB C, TAB, : scanf( % d, &a) ; : 12A a scanf( % d% d% d, &a, &b, &c) ;, Tab a = 5, b = 6, c = 7, : TAB 6 TAB 7,, : c scanf( % c% c% c, &a, &b, &c) ; : pqr p a, b, q : scanf( % d, % d, % d, &a, &b, &c) ;,, : 5, 6, 7 = 7 scanf( a = % d, b = % d, c = % d, &a, &b, &c ) ; a = 5, b = 6, c,, % *, : scanf( % d, % * d, % d, &a, &b) ; : 1, 2, 3, 1 a, 2, 3 b, : ( Tab) ; ; scanf,, { int a, b, c; printf( % d \n, scanf( % 3d - % 2d - % 4 d, &a, &b, &c) ) ; printf( a = % d, b = % d, c = % d \ n, a, b, c) ; 43

57 , ,, : 3 a = 123, b = 45, c = , 2, : 2 a = 12, b = 34, c = xx( ) 3 ) getchar putchar 44 / getchar ; putchar putchar : putchar( ) : ( ) : : putchar( A ) ; A putchar( x) ; x putchar( \ n ) ;,, : getchar : getchar( ) :,, : char ch; ch = getchar( ) ; getchar( ), : getchar,, / stdio. h I / O : stdin stdout stderr, I / O { putchar( ) char ch1 = N, ch2 = E, ch3 = W ; putchar( ch1) ; / * ch1 * / putchar( ch2) ; putchar( ch3) ; putchar( \ n ) ; / * * /

58 C putchar( ch1) ; putchar( \n ) ; / * ch1, * / putchar( E ) ; putchar( \ n ) ; / * E, * / putchar( ch3) ; putchar( \n ) ; : NEW { char c1, c2; int b; c1 = A ; N E W printf( Please input two character: ) ; c2 = getchar( ) ; / * 1 c2* / b = 65 ; putchar( A ) ; putchar( \101 ) ; putchar( c1) ; putchar( b) ; putchar( c2) ; : Please input two character: : b : AAAAb , :,,,,, 3 C ( ) / ;

59 46, : ( ),, :,, ; ; ; ( ) H, F,? ( 1) :, ( 2) :, X, Y, :, : X + Y = H 2X + 4Y = F X = 4H - F, Y = F - 2H 2 2 ( 3) :,,,, : ( ) : ( ) : ; ; ( ) : : ; ( 4) ( 2. 5 ),,,, : : : h, f input: h, f output: x, y 2. 5

60 C x < - ( 4* h - f) /2 y < - ( f - 2* h) /2 : x, y :, x = ( 4* h - f) /2 x = ( 4 * f - h) /2,,,,,,, ( 5) : { int h, f, x, y; printf( Enter Number of Heads and Feet: h, f\ n ) ; scanf( % d, % d, &h, &f) ; x = ( 4* h - f) /2; y = ( f - 2* h) /2; printf( Head = % d, Feet = % d \ n, h, f) ; printf( Cock = % d, Rabbit = % d \ n, x, y) ; ( 6) ( ) ( 7) ( ),,,, h f,, 2. 21, ( 1) :, : ( 2) ( ) : : input: ( length), ( width) output: ( girth), ( area) : length, width girth < - ( length + width) * 2 area < - length * width = 2 ( + ) = 47

61 48 : girth, area ( 3) : { float length, width, girth, area; / * * / printf( Enter the length and width: ) ; scanf( % f, % f, &length, &width) ; / * * / girth = ( length + width) * 2; / * * / area = length* width; / * * / printf( Girth = % f\n, girth) ; / * * / printf( Area = % f\ n, area) ; / * * / : Enter the length and width: 1. 2, Girth = Area = , ASCII, ASCII ( 1) : a ASCII = 97, A ASCII = 65, a - A 32;, ASCII = 32 ( : a - A ) ( 2) ( ) ( ) ( 3) : { char c1, c2; printf( Input a lowercase letter: ) ; c1 = getchar( ) ; putchar( c1) ; printf(, % d \ n, c1) ; c2 = c1-32; /* : c2 = c1 - ( a - A ) * / printf( % c, % d \ n, c2, c2) ; : Input a lowercase letter: a a, 97 A, 65

62 C ( 1) ( A) abc ( B) abc ( C) abc ( 2) C, ( D) a ( A) 0 L ( B) ( C) ( D) e12 ( 3) int a = 3 ;, a + = a - = a * a;, a ( A) 3 ( B) 0 ( C) 9 ( D) - 12 ( 4), ( a = 2, b = 5, b + +, a + b ) ( A) 7 ( B) 8 ( C) 6 ( D) 2 ( 5) : int k, a, b; unsigned long w = 5; double x = 1. 42; C ( A) x% ( - 3) ( B) w + = - 2 ( C) k = ( a = 2, b = 3, a + b) ( D) a + = a - = ( b = 4) * ( a = 3) ( 6) 18 /4* sqrt( 4. 0) /8 : ( A) int ( B) float ( C) double ( D) ( 7) int x, y; double z;, scanf ( A) scanf( % d% lx, % le, &x, &y, &z) ;( B) scanf( % 2d * % d% lf &x, &y, &z ) ; ( C) scanf( % x % * d% o, &x, &y) ; ( D) scanf( % x% o% 6. 2f, &x, &y, &z) ; ( 8), a1, a2, c1, c2 10, 20, A, B,, int a1, a2; char c1, c2; scanf( % d% d, &a1, &a2) ; scanf( % c% c, &c1, &c2) ; ( < > ) ( A) 1020AB ( B) AB ( C) AB ( D) AB ( 9) C, sizeof( float) ( A) sizeof ( B) ( C) ( D) 49

63 ( 1)?? ( 2) C,?? ( 3) C,? 2. 3, ( 1) # include < stdio. h > { / * * / int a = 5 ; char c = a ; float f = 5. 3; double m = ; double result; / * * / printf( a + c = % d \ n, a + c) ; printf( a + c = % c \ n, a + c) ; printf( f + m = % f\ n, f + m) ; / * * / printf( a + m = % f \n, a + m) ; printf( c + f = % f\ n, c + f) ; / *, * / result = a + c * ( f + m) ; printf( double = % f\ n, result) ; ( 2) { int a = 5, b = 7; float x = , y = ; char c = A ; long n = ; unsigned u = ; printf( % d% d \ n, a, b) ; printf( % 3d% 3d \n, a, b) ; printf( % f, % f \n, x, y) ;

64 C printf( % - 10f, % - 10f\ n, x, y) ; printf( % 8. 2 f, % 8. 2f, % 4f, % 4f, % 3f, % 3f\ n, x, y, x, y, x, y) ; printf( % e, % 10. 2e \ n, x, y) ; printf( % c, % d, % o, % x\ n, c, c, c, c) ; printf( % ld, % lo, % x \ n, n, n, n) ; printf( % u, % o, % x, % d \ n, u, u, u, u) ; printf( % s, % 5. 3s \ n, COMPUTER, COMPUTER ) ; ( 3) # include < stdio. h > { int i, j, k; int m, n, p; i = 8; j = 10 ; k = 12; / * * / m = + + i; printf( i = % d \ n, i) ; printf( m = % d \ n, m) ; / * * / n = j - - ; printf( j = % d \ n, j) ; printf( n = % d \ n, n) ; / * * / p = ( + + m) * ( n + + ) + ( - - k) ; printf( k = % d \ n, k) ; printf( p = % d \ n, p) ; ( 4) { 2. 4 int x = 0, y = - 1, z = - 1; x + = - z y; printf( % d, % d, % d \n, x, y, z) ; 51

65 ( 1) r = 1. 5, h = 3, scanf,,, ( 2) ASCII ( 3) 30, 90, 52

66 C 3. 1 C 53, C C,,, 3 3 :,, 3. 1,,,,,,

67 C , 2 C 6, 3. 1 : 3. 1 < < = > > = ==! = ( ) ( ) 6, 4 ( < < = > > = ), 2 ( ==! = ), 2 2 ( ) : 1 2 : a + b > c - d, x > 3 /2, a + 1 < c, - i - 5 * j == k + 1, ( a > b) > ( b < c )

68 C C,, 1, 0, ; : a = 3, b = 2, c = 1, : a > b, 1 ( a > b) == c ( a > b 1, c ), 1 b + c < a, 0 : : d = a > b, f = a > b > c, : d 1 f 0 ( a > b 1, c, f = 0) : num1 = 3, num2 = 4, num3 = 5, : num1 > num2 = 0 ( num1 > num2)! = num3 = 1 num1 < num2 < num3 = 1 ( num1 < num2) + num3 = 6, num1 < num2 = 1, = 6 : C 1, 0,,, 3. 1 / * ex3-1. cpp * / { int x = 1, y = 2, z; z = 5-1 > = x + 2 < = y + 3; /* * / printf( z = % d \n, z) ; : z = , x > = 0 x > = 0 x < 10, C 3, ! ( ) && ( ) ( )

69 56 : &&,,,!,,,!, &&, :! ( ) &&( ) ( ) : ( a > b) && ( b > c ) b > d : ( ( a > b) && ( b > c) ) b > d, : b a c, b d :! && 2 ( ) : 1 2, : ( x > = 0) && ( x < 10) ( x < 1) ( x > 5 )! ( x == 0) ( year% 4 == 0) &&( year% 100! : x 0 x < 10 : x < 1 x > 5 : x 0 100, year 400! ( b == c) d < a a + b > c && x + y < b = 0) ( year% 400 == 0) : year 4 : b c a > d : a + b > c x + y < b 2, &&( ) ( ) 5 > 0 && 4 > 2 2, 5 > 0, 4 > 2,, 2, 5 > 0 5 > 8, 2 5 > 0,,! ( ), ;,! ( 5 > 0) C, 1, 0,, 0, 0 : 5 3 0, 5&&3, 1

70 C : 5 0, 1 : num = 12,! num 0; num > = 1 && num < = 31 1; num num > 31 1 C, 2 :,, :,, :,, ;,, : a && b && c, a, b ; a b, c a, b c,, a b c, a, b c, a, b ; a b, c, / * ex3-2. cpp * / { int a, b, c, d, j, k; a = 1, b = 2, c = 3, d = 4, j = k = 1 ; ( j = a > b) &&( k = c > d) ; / * * / printf( j = % d, k = % d \ n, j, k) ;

71 58 : j = 0, k = 1 : ( j = a > b), j 0, ( j = a > b) &&( k = c > d) 0 ;, ( k = c > d), k { int a, b, c, d; / * * / a = 1; b = 2; c = 0; / * * / d = a + b > c; / * * / printf( " % d \n", d) ; d = a + b < c; / * * / printf( " % d \n", d) ; d = a + c == b; / * * / printf( " % d \n", d) ; d = a ++ &&b ++++ &&c ++ ; / * * / printf( " a = % d, b = % d, c = % d, d = % d \ n", a, b, c, d) ; d = a ++ b ++ &&c ++ ; / * * / printf( " a = % d, b = % d, c = % d, d = % d \ n", a, b, c, d) ; : a = 2, b = 3, c = 1, d = 0 a = 3, b = 3, c = 1, d = ,,

72 C ( ), :, C C, 2 : if switch, if if 3 : if else if if else if else ( 1) if ( if-else ) : if( ) 1; else 2; :, ( 0 ), 1, if ;, 2, if 3. 4 : if ( ) 3. 4,,, 1 2, else ( ) if, if, 3. 4 a, a ( a 0) ( 1) : a - a ( a < 0) ( 2) ( ) : 59

73 60 a if( a > 0) then b = a else b b = - a ( 3) C : { float a, b; scanf( " % f", &a) ; if( a > = 0) else b = a; b = - a; printf( " The absolute value of % f is % f \n", a, b) ;,, 1 2, 3. 5,,, ( 1) :, a b c, : ( : a + b > c a + c > b b + c > a ) : ( ) : a, b, c if ( ) then else s = ( a + b + c) /2; s = ( a + b + c) /2 area = s( s - a ) ( s - b) ( s - c) area = sqrt( s* ( s - a) * ( s - b) * ( s - c) ) ; : area : " error" ( 3) C :

74 C #include < math. h > { float a, b, c, s, area; scanf( " % f, % f, % f", &a, &b, &c) ; if( a + b > c && a + c > b && b + c > a) { s = ( a + b + c) /2; area = sqrt( s* ( s - a) * ( s - b) * ( s - c) ) ; printf( " % f\ n", area) ; else printf( " data error \n" ) ;, ; 1 ; ( sqrt),, math. h, #include < math. h >, main if, C, if : 3 x, y, z, 2 x, y, max ; z max, max ;, max 3 ( 2) ( ) : : x, y, z if( x > y) then max = x else max = y if( z > max) then max = z : max ( 3) C : / * ex3-6. c* / { int num1, num2, num3, max; 61

75 62 printf( " Please input three numbers: " ) ; scanf( " % d, % d, % d", &num1, &num2, &num3) ; if ( num1 > num2 ) max = num1 ; else max = num2 ; if ( num3 > max) max = num3 ; printf( " The three numbers are: % d, % d, % d \ n", num1, num2, num3) ; printf( " max = % d \n", max) ; 1 if, else : max = num1; if( num2 > max) max = num2; : max( ), max, max, max,, max 3 3 ( 2) if ( if ) : if( ) ; :, ( 0),, if ; ( 0), if : if ( ),,,,

76 C if else else 3. 7, ( if ) { float a; 3. 8 scanf( " % f", &a) ; if( a < 0) a = - a; printf( " % f\ n", a) ;,, ( 1) ( ) : : x if( x 2 ) then x, : x ( 2) C : / * ex3-8. cpp * / { int x; printf( " input: x \n" ) ; / *, * / scanf( " % d", &x) ; if( x% 2) / * : x 2, 0* / printf( % d is odd number. \ n, x) ; ( 3) if ( if else ) if if, if : 63, if

77 : 1,, 2,, 1; 2 2 ; 1, 3,, 3; 4, : C,, : if else if ; if if ( else ) if, else if : else if : if ( 1) if ( 2 ) 1 else if ( 3 ) 2 else 3 else if,, else if,,?,,,, ( if else, ), if ( 1) { if ( 2 ) 1

78 C else if ( 3 ) 2 else 3,, : if, { 3. 9 : { int x, y; y = scanf( " % d", &x) ; if ( x < 1) y = x; if ( x > = 1 && x < 10) y = 2* x - 1; if ( x > = 10) y = 3* x - 11; printf ( " % d, % d", x, y) ; x ( x < 1) 2x - 1 ( 1 < x < 10) 3x - 11 ( x 0), ( 1) : ; 400 ( 2) : : year if( ( year 4 ) ( year 100 ) ( year 400 ) ) else leap = 1 leap = 0 if ( leap = 1) else ( year, ) ( year, ) 65

79 66 ( 3) C : { int year, leap; scanf( " % d", &year) ; if( ( year% 4 == 0) &&( year% 100! = 0) ( year% 400 == 0 ) ) leap = 1; else leap = 0; if ( leap) printf( " % d is a leap year \ n", year) ; else printf( " % d is not a leap year \n", year) ; :, ( 4) elseif ( if elseif else ) if else, else if, if else ( : if elseif else ) : if( 1) 1 else if ( 2) 2 else if ( 3) 3 else if ( m) m else m + 1 : 1,, 1; 2 :,, 2; 3,, 3; m,, m, m , 2 ; 2

80 C 3. 7, 3, else, 1, 0( ),, ; 0 ( ), m + 1, else m , 5% ; 100, 7. 5% ; 300, 10% ; 500, 15% ; 50, 0? { float total, con; scanf( " % f", &total) ; if ( number > 500) con = ; else if ( number > 300) con = ; else if ( number > 100) con = ; else if ( number > 50) con = ; else con = 0; printf( " % f", total - total* con) ; , 67

81 68 { long num, place; printf( " ( ) : " ) ; scanf( " % ld", &num) ; if( num > 9999 ) place = 5; else if( num > 999) place = 4; else if( num > 99) place = 3; else if( num > 9 ) else place = 2; place = 1; printf( % ld % d! : \ n, num, place) ; { int x, sign; sign( x) = printf( Please input a number \ n ) ; scanf( % d, &x) ; if( x > 0) sign = 1; else if( x = = 0) else sign = 0; sign = - 1; printf( The sign is % d \ n, sign) ; 2 ) - 1 ( x < 0) 0 ( x = 0) 1 ( x > 0) if, 2 :

82 C ( ), ; C if?:, C, 3 : 1? 2: 3 : 1, 1 0 ( ),, if : 2 ; 1 0 ( ), 3 if( x < y) else max = y; max = x; if :, : max = ( x < y)? y: x,, max = ( a > b)? a: b max = a > b? a: b? :, : a > b? a: c > d? c: d a > b? a: ( c > d? c: d),, { float a, b, sum; a + b printf( " Input 2 reals: " ) ; scanf( " % f, % f", &a, &b) ; sum = b > 0. 0? a + b: a - b; printf( a + b = % f\ n, sum) ;,, ;, { char ch; printf( " Input a character: " ) ; 69

83 scanf( " % c", &ch) ; ch = ( ch > = A && ch < = Z )? ( ch + 32) : ch; printf( " ch = % c \ n", ch) ;, if 3 ) switch case ( ) 70 if, if,,,, C switch, switch : switch( ) { case 1 : 1; [ break; ] case 2 : 2 ; [ break; ] case n: n; [ break; ] default: n + 1 :,, case, ; break, :, number, number 2, statement2,, break, switch, statement5, :, number, number 2, statement2,, break, statement3,, break, statement4,, switch, statement5

84 C :,, ( case ) case, ; case2: case 2: break default case break, case,, { case : case A : case B : case C : printf( " > 60 \ n" ) ; break; A B C3, default, ; default, default, default break switch : case switch { int x = 1, y = 0, a = 0, b = 0 ; switch( x) { case 1: switch( y) { case 0: a ++ ; break; case 1: b ++ ; break; 71

85 72 case 2: a ++ ; b ++ ; break; case 3: a ++ ; b ++ ; printf( " a = % d, b = % d \n", a, b) ;, { char grade; printf( " input the grade: " ) ; scanf( " % c", &grade) ; switch( grade) { case A : printf( " \ n" ) ; case case break; B : printf( " \ n" ) ; break; C : printf( " \ n" ) ; break; case D : printf( " < 60 \ n" ) ; break; default: printf( " error \ n" ) ; { char grade; 60 printf( " Input the grade: " ) ; scanf( " % c", &grade) ; switch( grade) { case A : case B : case case C : printf( " > = 60 \ n" ) ; break; D : printf( " < 60 \ n" ) ; break;

86 C { char c; default: printf( " error \n" ) ;, ;, int i = 0; c = getchar( ) ; switch( c) { case 9 : i ++ ; case 8 : i ++ ; case 7 : i ++ ; case 6 : i ++ ; case 5 : i ++ ; case 4 : i ++ ; case 3 : i ++ ; case 2 : i ++ ; case 1 : i ++ ; case 0 : printf( " It is a digiter % d. \ n", i) ; break; case : printf( " It is a space. \n" ) ; break; default: printf( " It is other character. \n" ) ;, { int year, month, days; printf( " input year, month =? \ n" ) ; scanf( " % d, % d", &year, &month) ; switch( month) { case 1: case 3: case 5: case 7: case 8: 73

87 74 case 10: case 12: days = 31; break; case 4: case 6: case 9: case 11: days = 30; break; case 2: if( ( year% 4 == 0 ) &&( year% 100! = 0) ( year% 400 == 0) ) days = 29; else days = 28; break; default: printf( " month is error \ n" ) ; printf( " year = % d, month = % d, days = % d \n", year, month, days) ; ,,, ;, 3, C, 3, : while do while for while while while, :

88 C, while : while( ) :, 0 ( ), ;, 0 ( ),, 0 ( ),, ; 3. 8 while : 3. 8 while while, 0,, C while n n = 1 ( 1) : sum, 0, sum + = n ( n 1, 2, 100), 3 : n 1 ; 1 sum + = n, n 1 ; n 101,, sum ( 2) : sum n, 0; n < = 100,, ; sum + n sum, n + 1 n; ; sum. ( 3) : sum 0, n 1 While( i < n) Sum sum + i n n + 1 : sum

89 76 ( 4) C : { int n = 1, sum = 0; while( n < = 100) { sum + = n; / * sum = sum + n; * / n ++ ; printf( sum = % d \ n, sum) ; { char ch; 26 ch = Z ; while( ch > = A ) { putchar( ch) ; ch - - ; / *, * / printf( " \n" ) ; do while do while while,, : do while( ) ; :, 0( ), ;, ; 0( ),, 0( ),, ; 3. 9 do while : do while,,

90 C, { C, while( ) 3. 9 donwhile { int n, sum; n = 1, sum = 0; do { sum + = n; n ++ ; while ( n < = 100) ; do while n n = 1 ( 1) : ( ) ( 2) C : printf( sum = % d \ n, sum) ; ( 1) :, ( 10 ), ;, ; ( 2) : : n While ( n 0) r < - ( n /10 ) ( : n 10, ) : r( ) n < - ( n /10) ( : n 10, ) ( 3) C : { int i, r; printf( " Input an integer \n" ) ; sanf( " % d", &i) ; do { r = i % 10; 77

91 printf( " % d", r) ; while ( ( i / = 10)! = 0 ) ; printf( " \n" ) ; for 78 for C for,, for for : for( 1; 2; 3 ) for 3 ; ; : ; ; 1 ( ) 2 ( ) 3 ( ) : 3. 9, 0,, ;,,, ; for for : :,, 0 1, 3 ; 2,,, 2, 3, : for ( sum = 0; i < = 100; i ++ ) sum + = i; for ( sum = 0, i = 1 ; i < = 100 ; i ++ ) sum + = i; for ( i = 0, j = 100; i < = j; i ++, j - - ) k = i + j;, C for

92 C, ; for, for C, , : a. 1 3,, while : for( ; i < = 100; ) { sum = sum + i; i ++ ; : while( i < = 100) { sum = sum + i; i ++ ; b. 3, 2 ;, for ( i = 1; i < = 100; ) { sum = sum + i; i ++ ; c. 2,,, break, goto, exit( ), return ;, : for ( i = 1; ; i ++ ) sum = sum + i; : while ( 1 ) { sum = sum + i; i ++ ; for while do while, for while : 1; while ( 2 ) { 3; for : for : x 0 = < x < N, N, N ; for ( int x = 0; x < N; x ++ ) { x 0 = < x < = N - 1, N - 1, N ; for ( int x = 0; x < = N - 1; x ++ ) {,, for n n = 1 ( 1) : ( ) ( 2) C : { int n, sum = 0; 79

93 80 for( n = 1; n < = 100; n ++ ) sum + = n; printf( sum = % d \ n, sum) ; n n! ( n! = n) ( 1) : fact, 1, fact = fact* fact 1; 1 fact = fact* i ( i 1, 2,, n), 3 : i, i 1; i n,, fact n! ( 2) 5 : fact n i; i = 1, fact = 1; i < = n,, ; fact* ; fact i fact, i + 1 i; ( 3) : : n fact 1, i 1 While( i < = n) fact fact* i : fact ( 4) C : { int i, n; long fact = 1; / * fact 1* / printf( Input n: ) ; scanf( % d, &n) ; for( i = 1 ; i < = n; i ++ ) fact * = i; / * * / printf( " % d! = % ld \ n", n, fact) ; 2, ( 1) : 1, m, 2 m - 1 m, m, m, m, m

94 C ( 2) : : num( : num > 2) flag 0 ( num ), i 2 while( i < = num - 1) if( num i ) flag = 1( num ) ; if( flag = 0) : num, " " else : num, " " ( 3) C : #include < math. h > { int m, i, flag; flag = 0; scanf( " % d", &m) ; for( i = 2 ; i < m - 1; i ++ ) if( m % i == 0) flag = 1; if( flag == 0) printf( " % d is a prime. ", m) ; else printf( " % d is not a prime. ", m) ; while do while for 3,, 3 : 3 ( while do while for), while do while, while ;, ( ) for 3, 3 for, while

95 , for while do while, while do while for 1 while for,, ; do while,, ,,,, ;, ( ) C 3 do while while for : while while for for do while do while while for :, : ;, 3. 27

96 C A BB CCC DDDD EEEEE ( 1) : 5, ; A, B C D E ( ASCII : A + i 64 + i) ;, ( 2) : i 1 j 1 : ch A While( i < = 5) While( j < = i) i i + 1 : ch j j + 1 ch < - ch + 1 ( 3) C : { int i, j; char ch; ch = A ; for( i = 0 ; i < 5; i ++ ) { for( j = 0 ; j < = i; j ++ ) printf( " % c", ch) ; + 1; * / printf( " \n" ) ; ch = ch + 1; { int i, j; printf( " * " ) ; /* printf( " % c", ch + i) ; ch = ch 83

97 84 for( i = 1 ; i < = 9; i ++ ) / * * / printf( " % 4d", i) ; printf( " \n" ) ; for( i = 1 ; i < = 9; i ++ ) / * * / { printf( " % 4d", i) ; / * * / : for( j = 1 ; j < = i; j ++ ) / * * / printf( " % 4d", i* j) ; / * * / printf( " \n" ) ; / * * / * a b, a b :, 1, 2 : n, 2 n /2 n,, n n, 2 n n,, n ( 2) : n, for n :, 2 ( n - 1 ) n,,, 0 ( 3) ( ) : : : a, b num a

98 C while( num < = b) k num i 2 while( i < = k) if( num i ) num, num; else : num ; num; i i + 1 num num + 2 ( 4) C : #include < math. h > { int a, b, num, i, k; scanf( " % d, % d", &a, &b) ; for( num = a; num < = b; num ++ ) { k = sqrt( num) ; for( i = 2 ; i < = k; i ++ ) if( num% i == 0) break; if( i > k) / * break : i < k * / printf( " % d is a primenumber. \ n", num) ; C, for, while, do while,,,, CPU, ( b) ( a)

99 for ( row = 0; row < 100; row ++ ) { for ( col = 0; col < 5; col ++ ) { sum = sum + row* col; ( a) : for ( col = 0; col < 5; col ++ ) { for ( row = 0; row < 100; row ++ ) { sum = sum + row* col; ( b) :,, ( c) ( d) N - 1,,, N, ( d), N,, ( c), 86 for ( i = 0; i < N; i ++ ) { if ( condition) DoSomething( ) ; else DoOtherthing( ) ; ( c) if ( condition) { for ( i = 0; i < N; i ++ ) DoSomething( ) ; else { for ( i = 0; i < N; i ++ ) DoOtherthing( ) ; ( d) goto goto, : goto ; goto : :

100 C,, goto, goto if,, : for( ) { if c then goto L; L:, goto, goto,, goto,, goto, goto,,, goto, : goto state; float s1, s2; / / goto int sum = 0; / / goto state:, goto goto,,, goto goto,,, break ; : { for { for { for if( disaster) goto error; error:,, goto,, goto if, goto 87

101 1 100 : { int k = 1, sum = 0; loop: if( k < = 100) sum + = k; k ++ ; goto loop; printf( % d \n, sum) ; C, goto break 88 break break break : break; : switch : switch ; " break " switch while for do while break break C : { int i; for( i = 1 ; i < = 100 ; i ++ )

102 C { printf( " % d ", i) ; if( i > 9) printf( " \n" ) ; break; ( 1) : : 1 100, 13, j 100, ;, 13 ; 13, 13 ;, ( 2) ( ) ( 3) C : { int j; for( j = 100; j > = 0 ; j - - ) / * j 100, * / if( j% 13 == 0 ) / * 13 * / break; / * 13, * / printf( % d \n, j) ; continue continue, : continue; : :, : continue, while for do while continue n : ( 1) : sum = n, ( 10 ), ;, ;

103 90 ( 2) : LIMIT 10 n 1, sum 0 while( sum < LIMIT) an 1 /n sum sum + an n < n + 2 : n ( 3) C : #define LIMIT 10 { int n = 1; float sum = 0. 0; for( ; ; ) { sum = sum / n; if( sum > LIMIT) break; n ++ ; printf( " n = % d \ n", n) ; ( 1) : : 1 100, 7 : j 1, ;, 7 7,, ;,, ; j > 100, ( 2) : num 1 while( num < = 100)

104 C if( num 7 ) else, num;, num; num num + 1 ( 3) C : { int num; for( num = 1; num < = 100; num ++ ) { if( num% 7 == 0) continue; / * 7,, * / printf( % d \ n, num) ; , ( 1) : 3 x, y, z, x, y, x, y, x z, x, z ; y z, y ; z ;, 3 : x < y < z ( 2) ( ) : : input: x, y, z output: x, y, z( x < y < z) : x, y, z : x, y, z if( x > y) then x y

105 92 if( x > z) then x z if( y > z) then y z : x, y, z ( 3) C : { int x, y, z, temp; printf( Input x, y, z \ n" ; scanf( % d, % d, % d, &x, &y, &z) ; printf( % d, % d, % d \ n, x, y, z) ; if( x > y) if( x > z) emp = x, x = y, y = temp; temp = x, x = z, z = temp; if( y > z) temp = y, y = z, z = temp; printf( x < y < z: % d, % d, % d \ n, x, y, z) ; a x 2 + bx + c = 0 ( 1) :, : a b 2 b 2 b 2 = 0, - 4a c = 0, 2-4a c > 0, 2-4a c < 0, 2 ( 2) ( ) : : input: a, b, c temp: d( d = b 2 output: x1, x2 : a, b, c if( a = 0) then d < b 2 : " " - 4ac if( d = 0) then - 4ac), p, q x1, x2 < - b / ( 2* a)

106 C : " x1 = x2 = : ", x1 if( d > 0) then x1 < ( - b + sqrt( d) ) /( 2 * a) ; x2 < ( - b - sqrt( d) ) /( 2 * a) ; : " x1", x1, " x2 = ", x2 if( d < 0) then p < - b / ( 2* a) q < qrt( - d) /( 2* a) : " : ", x1, x2 ( 3) C : #include < math. h > { float a, b, c, d, x1, x2, p, q; printf( " a, b, c =?" ) ; scanf( " % f, % f, % f", &a, &b, &c) ; / * * / printf( " The equation" ) ; if ( fabs( a) < = 1e - 6) / * a = 0 * / printf( " is not quadratic" ) ; else { d = b* b - 4* a* c; /* * / if( fabs( d) < 1e - 6 ) /* = 0 * / printf( " has two equal roots: % 8. 4f\ n", - b / ( 2* a) ) ; else if( d > 1 e - 6) /* > 0 * / { x1 = ( - b + sqrt( d) ) / ( 2* a) ; x2 = ( - b - sqrt( d) ) / ( 2* a) ; printf( " has distinct real roots: % 8. 4 f and 8. 4f\ n", x1, x2) ; else /* < 0 * / { p = - b / ( 2* a) ; q = sqrt( - d) / ( 2* a) ; printf( " has complex roots: \n" ) ; printf( " % 8. 4f + % 8. 4fi \ n", p, q) ; printf( " % 8. 4f - % 8. 4fi \ n", p, q) ; 93

107 , profit( ) ( : ) : profit ; 1000 < profit % ; 2000 < profit % ; 5000 < profit % ; < profit 25% ( 1) : switch, profit, ( 1 000, 2 000, ), profit 1 000, : profit , < profit , < profit , 3, 4, < profit , 6, 7, 8, 9, < profit 10, 11, 12 ( 2), : profit 1 ( ), 1000 : profit < profit < profit , 3, < profit , 6, 7, 8, < profit 10, 11, 12 ( 2) ( ) : ( ) ( 3) C : { long profit; int grade; float salary = 500; /* * / printf( " Input profit: " ) ; scanf( " % ld", &profit) ; /* profit* / grade = ( profit - 1 ) / ; / * , switch case * / switch ( grade) { case 0: break; /* profit 1000 * / case 1: salary + = profit* 0. 1; break; /* 1000 < profit 2000 * / case 2:

108 C case 3: case 4: salary + = profit* 0. 15; case 5: case 6: case 7: case 8: break; /* 2000 < profit * / case 9: salary + = profit* 0. 2; break; /* 5000 < profit * / default: salary + = profit* 0. 25; /* < profit * / printf( " salary = %. 2f \n", salary) ; 2, ( + - * / ), ;, ( 1) :,, if - else if, switch switch, switch, ( 2) ( ) : ( ) ( 3) C : { int a, b, d; char c; printf( " Enter Two Numbers: " ) ; scanf( " % d, % d", &a, &b) ; printf( " Enter Operator( +, -, *, / ) : " ) ; scanf( " % c", &c) ; switch ( c) { case + : d = a + b; printf( " % d + % d = % d \ n", a, b, d) ; break; case - : d = a - b; printf( " % d - % d = % d \ n", a, b, d) ; break; case * : d = a* b; printf( " % d* % d = % d \ n", a, b, d) ; break; 95

109 case / : if( b == 0) printf( " Divisor is zero\ n" ) ; else { d = a / b; break; printf( " % d /% d = % d \n", a, b, d) ; default: printf( " Input Operator error! \n" ) ;, 1 ( 1) : n: 1 200, n, m* m == n ( : 1 < m < sqr( n) ),,, n ;,, n ; n > 100, ( 2) : n 1 while( n < = 200) m 1 while( m < sqr( n) ) if( m* m = n) else m < m + 1 n < - n + 1 ( 3) C : #include < math. h > void main ( ) { int m, n;, num;, num; for ( n = 1; n < = 200; n ++ ) for ( m = 1; m < = sqrt( n) ; m ++ ) if ( m * m == n) printf( " % d ", n) ; printf( " \n" ) ;

110 C sin( x 3 ) = x - x 3 /3! + x 5 /5! - x 7 /7! +, 10-7 ( 1) : : F n n, F n + 1 n + 1, F n + 1 x 2 = - F n 2n ( 2 n + 1 ), x ( 2) : : x, EPS k 1, an x, sum 0, n 1 while( an < EPS) sum sum + an an an* ( x* x) / ( ( 2* n* ( 2* n + 1) ) * k k - k n n + 1 : x, sum ( 3) C : #include < math. h > #define EPS 1e - 7 #define PI { int n; double x, an, sum; printf( " input x: " ) ; scanf( " % lf", &x) ; x = x* PI /180; / * * / sum = 0; an = x; n = 1; / * an * / do { sum + = an; an* = ( - x* x) / ( ( 2 * n* ( 2* n + 1 ) ) ; /* * / ++ n; while( fabs( an) > = EPS) ; / * fabs( ), * / printf( " sin( %. 4f) = %. 4f \n", x, sum) ; 97

111 ,, A Z, a z, : A E, a e, 4 ; W A, X B, Y C, Z D, China! Glmre!, ( 1) : ;, : 4 ( ASCII + 4 ), ( A E, a e) ( 2) ( ) : ch while( ch ) if( ch ) ch ch + 4 if( ch ) ch ch - 26 : ch ch ( 3) C : { char c; while ( ( c = getchar( ) )! = \ n ) { if( ( c > = a &&c < z ) ( c > = A &&c < = Z ) ) { c = c + 4; if( c > Z &&c < Z + 4 c > z ) c = c - 26; printf( " % c", c) ;

112 C ) ( GCD) ( LCM) ( 1) : 2 m n( m > n) ( ) : 2 m n( m > n) ; m n, r( 0 < = r < n) r 0, r 0, ; r = 0, n,, n > m, r > n r m n ; n, n 2 m n ( GCD), ( LCM) : 2 ( 2) : : num1, num2 if( num1 < num2) num1 num2, ( m > n) m num1, n num2 while( n 0 ) GCD m r m n ) m n( m = n) n r ( n = r) LCM num1* num2 / m : :, GCD : :, LCM ( 3) C : { int m, n, num1, num2, temp; printf( " Input two positive integer: \ n" ) ; scanf( " % d, % d", &num1, &num2) ; 99

113 if( num1 < num2) /*, num1 num2, ( m > n) * / temp = num1, num1 = num2, num2 = temp; m = num1; n = num2; while( n! = 0) { temp = m% n; m = n; n = temp; printf( " The greatest common divisor is: % d \ n", m) ; printf( " The lowest common multiple is: % d \ n", num1* num2 / m) ; 2 ) 100 :,, ( ) 2 : (,,, ) (, ) , 36 ; 4, 3, 2 1,? ( 1) :, : ( men) : 1 8 ( women) : 1 12 ( childs) : : 4* + 3* + /2 = 36 ( 2) : men 1 while( men < 9) women 1 while( women < 12 ) else childs 36 - men - women if( 36 ) ( men, women, childs), ;, ;

114 C ( 3) C : { int men, women, childs; for( men = 1; men < 9; men ++ ) for( women = 1 ; women < 12; women ++ ) { childs = 36 - men - women; if( 4* men + 3* women + childs/2. 0 = = 36) printf( " men = % d, women = % d, childs = % d \ n ", men, women, childs) ; : childs/2. 0 childs/2, C 2,, ( 1) ( ) : m = 6 m < = ,, n1 = 2 n1 < = m /2,,, n1,,, n2 = m - n1, m = n1 + n2,, n1 = n1 + 1, m = m + 2, ( 2) : ( ) ( 3) C : #include < math. h > { int flag, flag1, k, m, n; for( m = 6; m < = 2000; m = m + 2) for( n1 = 2; n1 < = m /2; n1 ++ ) { flag = 0; for( k = 2; k < = ( int) sqrt( n1) + 1; k ++ ) if( n% k = = 0) { flag = 1; 101

115 102 break; if( flag = = 0) { flag1 = 0; n2 = m - n1; for( k = 2 ; k < = ( int) sqrt( n2) + 1; k ++ ) if( ( m - n) % k == 0) { flag1 = 1; break; if( flag1 == 0) { printf( " % d = % d + % d \n", m, n1, n2) ; break; 3. 44, 2, 1 ; 3, 2 ; 5, 4 ; 6, 5 ; 7,? ( 1) :, 7 ; 7, 7,, ; 14 ( 2) : : input: ladders( : 7, 7 ) temp: k( : k = 1, ; k = 0, ) output: ladders( ) ladders < -7( 7 ) while( k) if( ) then ladders < - ladders + 14 ladders ( 3) C :

116 C { int ladders = 7; while( ladders% 3! = 2 ladders% 5! = 4 ladders% 6! = 5) ladders + = 14; printf( flight of stairs = % d \ n, ladders) ; 3 ) 3 : ; ; ( ) ( Fibonacci ) 1, 3 1,, 1?, ( Fibonacci) : 1, 1, 2, 3, 5, 8, 13, 21, 34 ( 1) : : 3,, fn_1 = fn_2 = 1 fn = fn_1 + fn_2, C : fn_2 = fn_1 ; fn_1 = fn ( 2) : FN1 1, FN2 1 : FN1, FN2 i 3 while( i N ) fn = fn_1 + fn_2; / * 1 2 * / FN FN1 + FN2 / * i * / : FN / * i * / FN2 FN1 FN1 FN ( 3) C ( 20 ) : 103

117 { int i, fn, fn_1 = 1, fn_2 = 1; printf( " % d, % d", fn_1, fn_2) ; for( i = 3 ; i < = 20; i ++ ) { fn = fn_1 + fn_2; printf( ", % d", fn) ; fn_2 = fn_1; fn_1 = fn; 4 ) 104 f( x) = 0, f( x) = 0 : x = ( x) ; x0, : x0, x1, x2, x3,, xn, ;,,, f( x) = 0,, ( ),, x 3-4 x x - 6 = ( 1) :, x k f( x) = 0 x*, P k ( x k, f( x k ) ) f ( x) : y = f ( x k ) + f ( x k ) * ( x - x k ) X : f( x k ) + f ( x k ) * ( x - x k ) = 0, : x k+ 1 = x k - f ( x k ) / f ( x k ), x k x*,,

118 C ( 2) : x ( 1. 5) while( ) X0 X F ( ( 2* X0-4) * x0 + 3) * x0-6 / * x0 * / F1 ( 6* X0-8) * x0 + 3 / * x0 : * / x x0 - F /F1; : ( x) ( 3) C : #include < math. h > { float x, x0, f, f1 ; x = 1. 5; do { x0 = x; f = ( ( 2 * x0-4) * x0 + 3) * x0-6; f1 = ( 6* x0-8) * x0 + 3; x = x0 - f /f1; while( fabs( x - x0) > = 1 e - 5) ; printf( " root = % f \n", x) ; 105 < 0 5 ) ( ) x 4-4 x x 2-8 x - 8 = 0 ( 1) : : : f( x) = 0 x1 x2, x1 x2, f( x1 ) * f( x2) x1 x2 : x = ( x1 + x2) /2 x1 x x2 : y1 = f( x1) y = f( x) y2 = f( x2 ) y = 0,, x ;, y y1, x2 = x;, x1 = x, :, y = f( x) 0, x, f( x), 0 f( x) == 0,, f( x) 10 - k f( x) 0, f( x)

119 , x ( ) 10 - k, 10-5 ( 2) : ( ) ( 3) C : ( 10-5 ) #include < math. h > { float x1, x2, x, y1, y2, y; do / * x1 x2, x1 x2 * / { scanf( " % f, % f", &x1, &x2) ; y1 = 2 * x1* x1* x1 * x1-4* x1 * x1* x1 + 6 * x1* x1-8 * x1-8; y2 = 2 * x2* x2* x2 * x2-4* x2 * x2* x2 + 6 * x2* x2-8 * x2-8; while( y1 * y2 > 0) ; while( 1) { x = ( x1 + x2) /2; y = 2* x* x* x* x - 4* x* x* x + 6 * x* x - 8* x - 8; y1 = 2* x1* x1* x1* x1-4* x1* x1* x1 +6* x1* x1-8* x1-8; y2 = 2* x2* x2* x2* x2-4* x2* x2* x2 +6* x2* x2-8* x2-8; if( fabs( y) < 1e - 5 ) break; else if( y* y1 > 0) x1 = x; else x2 = x; printf( " x = % f\ n", x) ;

120 C 3. 7,,,,,,, ,,, ( a),,, ( b) 107 / * * / void Function1( ) { / * * / void Function2( ) { / / * / void Function3( ) { ( a) : / * * / while ( condition) { statement1; / * * / if ( condition) { statement2; else { statement3; / * * / statement4; ( b) :

121 ,,, if for while do,, {, ( a), ( b) int width; / * * / int height; / * * / int depth; /* * / x = a + b; y = c + d; z = e + f; int width, height, depth; / * * / x = a + b; y = c + d; z = e + f; 108 if ( width < height) { dosomething( ) ; for ( initialization; condition; update) { dosomething( ) ; / * * / other( ) ; ( a) : if ( width < height) dosomething( ) ; for ( initialization; condition; update) dosomething( ) ; other( ) ; ( b) : : ( ),, : int width = 10; / * width* / int height = 10; / * height* / int depth = 10; / * depth* / const virtual inline case, if for while

122 C (,, (, (, ), ;,,, Function ( x, y, z) ;,, for ( initialization; condition; update), = + = > = < = + * % && < <, ^,! & ( ) [ ]. : for if, for ( i = 0 ; i < 10; i ++ ) if ( ( a < = b) && ( c < = d) ) void Func1( int x, int y, int z) ; void Func1 ( int x, int y, int z) ; if ( year > = 2000) if( year > = 2000) if ( ( a > = b) && ( c < = d) ) if( a > = b&&c <= d) for ( i = 0; i < 10; i ++ ) for( i = 0; i < 10; i ++ ) for ( i = 0; i < 10; i ++ ) x = a < b? a : b; x = a < b? a: b; int * x = &y; int * x = & y; array[ 5] = 0; array [ 5] = 0; / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / / * * / {, {, { ( a), ( b)

123 110 void Function( int x) { /* program code* / if ( condition) { /* program code* / else { /* program code* / for ( initialization; condition; update) { /* program code* / While ( condition) { /* program code* / {,, : { { void Function( int x) { / * program code* / if ( condition) { program code* / else { / * program code* / for ( initialization; condition; update) { / * program code* / while ( condition) { / * program code* / {,, : { { ( a) : ( b) : , 70 80,,, ; ( ),,,

124 C if ( ( very_longer_variable1 > = very_longer_variable12) && ( very_longer_variable3 < = very_longer_variable14) && ( very_longer_variable5 < = very_longer_variable16) ) { dosomething( ) ; for ( very_longer_initialization; very_longer_condition; very_longer_update) { dosomething( ) ; * &,, *, : int* x;, x int, : int* x, y; y x y, * & : char * name; int * x, y; / * y * / C / * * / : ; ;,,,,,,,

125 ,,,,,,, 112 /* * : * : * : * : * / void Function( float x, float y, float z) { if ( ) { while ( ) { / * end of while* / / * end of if* / ( 1) x [ 1, 10 ] [ 200, 210 ], ( A) ( x > = 1) &&( x < = 10) &&( x > = 200 ) &&( x < = 210) ( B) ( x > = 1 ) ( x < = 10) ( x > = 200) ( x < = 210) ( C) ( x > = 1 ) &&( x < = 10 ) ( x > = 200) &&( x < = 210) ( D) ( x > = 1) ( x < = 10) && ( x > = 200) ( x < = 210) ( 2) x y z, C : ( A) ( x > = y) AND ( y > = z) ( B) ( x > = y) && ( y > = z) ( C) ( x > = y > = z) ( D) ( x > = y) &( y > = z) ( 3 ) c 0, c a b ( A) ( a = c) &&( b = c) ( B) ( a = c) ( b = c) ; ( C) c = b = a; ( D) a = c = b; ( 4) a = 5, b = 4, ( A) ( a > b) &&( b - a) ( B) ( b > = 0) && ( a < = b? a + b: a - b) ( C) ( a < = 0) ( a% b) ( D) a &&! b

126 C ( 5) a int a, b, c; a = b = c = 1; ++ a ++ b&& ++ c ( A) ( B) 0 ( C) 2 ( D) 1 ( 6) for( i = 1; i + + < 4; ) ;, i ( A) 3 ( B) 4 ( C) 5 ( D) 1 ( 7) for( x = 0, y = 0; ( y! = 100 ) &&( x < 4 ) ; x + + ) ; ( A) ( B) ( C) 4 ( D) 3 ( 8) C while(! e) ;! e ( A) e == 0 ( B) e! = 1 ( C) e! = 0 ( D) e == 1 ( 9) i j int, for( i = 5; i; i - - ) for( j = 0; j < 4; j + + ) { ( A) 20 ( B) 24 ( C) 25 ( D) ( 1) C?? ( 2) C?? ( 3) switch - case? 3. 3, ( 2) # include < stdio. h > { / *, * / int logic; int a = 1; int b = 2; int c = 3; logic = a + b > c&&b < = c; printf( " logic = % d \n", logic) ; logic = a > = b + c b == c; printf( " logic = % d \n", logic) ;

127 logic =! ( a < c) + b! = 1 &&( a + c) /2 ; printf( " logic = % d \n", logic) ; 114 ( 2) { int a = 100, x = 10, y = 20, okl = 5, ok2 = 0; if ( x < y) if( y! = 10) if(! okl) a = 1; else if( ok2) a = 10; a = - 1 ; printf( " % d \n", a ) ; ( 3) void main3( ) { int num = 0; while( num < = 2) { num + + ; printf ( " % d \ n", num) ; ( 4), ADes iptor ( ), { char c; int v0 = 0, v1 = 0, v2 = 0; do{ switch( c = getchar( ) ) { case case a : A :

新版 明解C言語入門編

新版 明解C言語入門編 328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

Ps22Pdf

Ps22Pdf C ( CIP) C /. :, 2001. 7 21 ISBN 7-5624 -2355-5. C........ C. TP312 CIP ( 2001 ) 034496 C * * : 7871092 1 /16 : 14. 25 : 356 20017 1 20017 1 : 1 6 000 ISBN 7-5624-2355-5 / TP311 : 21. 00 C, C,,,, C,, (

More information

C/C++ - 文件IO

C/C++ - 文件IO C/C++ IO Table of contents 1. 2. 3. 4. 1 C ASCII ASCII ASCII 2 10000 00100111 00010000 31H, 30H, 30H, 30H, 30H 1, 0, 0, 0, 0 ASCII 3 4 5 UNIX ANSI C 5 FILE FILE 6 stdio.h typedef struct { int level ;

More information

新・解きながら学ぶC言語

新・解きながら学ぶC言語 330!... 67!=... 42 "... 215 " "... 6, 77, 222 #define... 114, 194 #include... 145 %... 21 %... 21 %%... 21 %f... 26 %ld... 162 %lf... 26 %lu... 162 %o... 180 %p... 248 %s... 223, 224 %u... 162 %x... 180

More information

nooog

nooog C : : : , C C,,, C, C,, C ( ), ( ) C,,, ;,, ; C,,, ;, ;, ;, ;,,,, ;,,, ; : 1 9, 2 3, 4, 5, 6 10 11, 7 8, 12 13,,,,, 2008 1 1 (1 ) 1.1 (1 ) 1.1.1 ( ) 1.1.2 ( ) 1.1.3 ( ) 1.1.4 ( ) 1.1.5 ( ) 1.2 ( ) 1.2.1

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

_汪_文前新ok[3.1].doc

_汪_文前新ok[3.1].doc 普 通 高 校 本 科 计 算 机 专 业 特 色 教 材 精 选 四 川 大 学 计 算 机 学 院 国 家 示 范 性 软 件 学 院 精 品 课 程 基 金 青 年 基 金 资 助 项 目 C 语 言 程 序 设 计 (C99 版 ) 陈 良 银 游 洪 跃 李 旭 伟 主 编 李 志 蜀 唐 宁 九 李 涛 主 审 清 华 大 学 出 版 社 北 京 i 内 容 简 介 本 教 材 面 向

More information

C/C++程序设计 - 字符串与格式化输入/输出

C/C++程序设计 - 字符串与格式化输入/输出 C/C++ / Table of contents 1. 2. 3. 4. 1 i # include # include // density of human body : 1. 04 e3 kg / m ^3 # define DENSITY 1. 04 e3 int main ( void ) { float weight, volume ; int

More information

C/C++语言 - C/C++数据

C/C++语言 - C/C++数据 C/C++ C/C++ Table of contents 1. 2. 3. 4. char 5. 1 C = 5 (F 32). 9 F C 2 1 // fal2cel. c: Convert Fah temperature to Cel temperature 2 # include < stdio.h> 3 int main ( void ) 4 { 5 float fah, cel ;

More information

C/C++ 语言 - 循环

C/C++ 语言 - 循环 C/C++ Table of contents 7. 1. 2. while 3. 4. 5. for 6. 8. (do while) 9. 10. (nested loop) 11. 12. 13. 1 // summing.c: # include int main ( void ) { long num ; long sum = 0L; int status ; printf

More information

C 1

C 1 C homepage: xpzhangme 2018 5 30 C 1 C min(x, y) double C // min c # include # include double min ( double x, double y); int main ( int argc, char * argv []) { double x, y; if( argc!=

More information

C/C++ - 字符输入输出和字符确认

C/C++ - 字符输入输出和字符确认 C/C++ Table of contents 1. 2. getchar() putchar() 3. (Buffer) 4. 5. 6. 7. 8. 1 2 3 1 // pseudo code 2 read a character 3 while there is more input 4 increment character count 5 if a line has been read,

More information

C C

C C C C 2017 3 8 1. 2. 3. 4. char 5. 2/101 C 1. 3/101 C C = 5 (F 32). 9 F C 4/101 C 1 // fal2cel.c: Convert Fah temperature to Cel temperature 2 #include 3 int main(void) 4 { 5 float fah, cel; 6 printf("please

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

C/C++语言 - 运算符、表达式和语句

C/C++语言 - 运算符、表达式和语句 C/C++ Table of contents 1. 2. 3. 4. C C++ 5. 6. 7. 1 i // shoe1.c: # include # define ADJUST 7. 64 # define SCALE 0. 325 int main ( void ) { double shoe, foot ; shoe = 9. 0; foot = SCALE * shoe

More information

C/C++语言 - 分支结构

C/C++语言 - 分支结构 C/C++ Table of contents 1. if 2. if else 3. 4. 5. 6. continue break 7. switch 1 if if i // colddays.c: # include int main ( void ) { const int FREEZING = 0; float temperature ; int cold_ days

More information

C/C++ - 字符串与字符串函数

C/C++ - 字符串与字符串函数 C/C++ Table of contents 1. 2. 3. 4. 1 char C 2 char greeting [50] = " How " " are " " you?"; char greeting [50] = " How are you?"; 3 printf ("\" Ready, go!\" exclaimed John."); " Ready, go!" exclaimed

More information

C

C C 2017 4 1 1. 2. while 3. 4. 5. for 6. 2/161 C 7. 8. (do while) 9. 10. (nested loop) 11. 12. 3/161 C 1. I 1 // summing.c: 2 #include 3 int main(void) 4 { 5 long num; 6 long sum = 0L; 7 int status;

More information

(京)新登字063号

(京)新登字063号 教 育 部 职 业 教 育 与 成 人 教 育 司 推 荐 教 材 Java 程 序 设 计 教 程 ( 第 二 版 ) 沈 大 林 主 编 沈 昕 肖 柠 朴 曾 昊 等 编 著 内 容 简 介 Java 是 由 美 国 SUN 公 司 开 发 的 一 种 功 能 强 大 的, 具 有 简 单 面 向 对 象 分 布 式 可 移 植 等 性 能 的 多 线 程 动 态 计 算 机 编 程 语 言

More information

3.1 num = 3 ch = 'C' 2

3.1 num = 3 ch = 'C' 2 Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:

More information

untitled

untitled 不 料 料 例 : ( 料 ) 串 度 8 年 數 串 度 4 串 度 數 數 9- ( ) 利 數 struct { ; ; 數 struct 數 ; 9-2 數 利 數 C struct 數 ; C++ 數 ; struct 省略 9-3 例 ( 料 例 ) struct people{ char name[]; int age; char address[4]; char phone[]; int

More information

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit 6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C51 6.1 C51 6.1.1 C51 C51 ANSI C MCS-51 C51 ANSI C C51 6.1 6.1 C51 bit Byte bit sbit 1 0 1 unsigned char 8 1 0 255 Signed char 8 11 128

More information

untitled

untitled Introduction to Programming ( 數 ) Lecture 3 Spring 2005 March 4, 2005 Lecture 2 Outline 數 料 If if 狀 if 2 (Standard Output, stdout): 料. ((Standard Input, stdin): 料. 類 數 數 數 說 printf 見 數 puts 串 數 putchar

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 9 [P.11] : Dev C++ [P.12] : http://c.feis.tw [P.13] [P.14] [P.15] [P.17] [P.23] Dev C++ [P.24] [P.27] [P.34] C / C++ [P.35] 10 C / C++ C C++ C C++ C++ C ( ) C++

More information

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; Memory & Pointer trio@seu.edu.cn 2.1 2.1.1 1 int *p int a 0x00C7 0x00C7 0x00C7 2.1.2 2 int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; 2.1.3 1. 2. 3. 3 int A,

More information

Microsoft Word - CPE考生使用手冊160524.docx

Microsoft Word - CPE考生使用手冊160524.docx 大 學 程 式 能 力 檢 定 (CPE) 考 生 使 用 手 冊 2016 年 5 月 24 日 這 份 手 冊 提 供 給 參 加 CPE 檢 定 考 試 的 考 生 內 容 包 含 考 試 環 境 的 使 用, 以 及 解 題 時 所 使 用 I/O 的 基 本 知 識 1. 如 欲 報 名 參 加 CPE 考 試, 請 先 於 CPE 網 站 完 成 帳 號 註 冊, 然 後 再 報 名 該

More information

C/C++ - 数组与指针

C/C++ - 数组与指针 C/C++ Table of contents 1. 2. 3. 4. 5. 6. 7. 8. 1 float candy [ 365]; char code [12]; int states [50]; 2 int array [6] = {1, 2, 4, 6, 8, 10}; 3 // day_mon1.c: # include # define MONTHS 12 int

More information

四川省普通高等学校

四川省普通高等学校 四 川 省 普 通 高 等 学 校 计 算 机 应 用 知 识 和 能 力 等 级 考 试 考 试 大 纲 (2013 年 试 行 版 ) 四 川 省 教 育 厅 计 算 机 等 级 考 试 中 心 2013 年 1 月 目 录 一 级 考 试 大 纲 1 二 级 考 试 大 纲 6 程 序 设 计 公 共 基 础 知 识 6 BASIC 语 言 程 序 设 计 (Visual Basic) 9

More information

1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7

1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7 1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7-80097 - 564-9 /TP 8 : 10. 00 ,,,, 1994 NCRE,,, ( ),,,,,

More information

プログラムの設計と実現II

プログラムの設計と実現II UNIX C ls mkdir man http://www.tj.chiba-u.jp/lecture/prog2/ Ctrl+x, Ctrl+s ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall

More information

科学计算的语言-FORTRAN95

科学计算的语言-FORTRAN95 科 学 计 算 的 语 言 -FORTRAN95 目 录 第 一 篇 闲 话 第 1 章 目 的 是 计 算 第 2 章 FORTRAN95 如 何 描 述 计 算 第 3 章 FORTRAN 的 编 译 系 统 第 二 篇 计 算 的 叙 述 第 4 章 FORTRAN95 语 言 的 形 貌 第 5 章 准 备 数 据 第 6 章 构 造 数 据 第 7 章 声 明 数 据 第 8 章 构 造

More information

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 C C trio@seu.edu.cn C C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 Week3 C Week5 Week5 Memory & Pointer

More information

untitled

untitled 3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

c_cpp

c_cpp C C++ C C++ C++ (object oriented) C C++.cpp C C++ C C++ : for (int i=0;i

More information

ebook8-30

ebook8-30 3 0 C C C C C C++ C + + C++ GNU C/C++ GNU egcs UNIX shell s h e l l g a w k P e r l U N I X I / O UNIX shell awk P e r l U N I X C C C C C C U N I X 30.1 C C U N I X 70 C C U N I X U N I X U N I X C Dennis

More information

Microsoft Word - 09.數學136-281.docx

Microsoft Word - 09.數學136-281.docx 136. 計 算 梯 型 面 積 (1 分 ) 請 以 JAVA 運 算 式 計 算 下 面 梯 形 面 積, 並 輸 出 面 積 結 果 梯 形 面 積 公 式 為 :( 上 底 + 下 底 ) 高 2 每 一 組 依 序 分 別 輸 入 梯 形 的 上 底 下 底 及 高 的 整 數 輸 出 梯 形 面 積 輸 入 輸 出 94 190 120 99 54 47 137. 計 算 三 角 形 面

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc 2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 177 [P179] (1) - [P181] [P182] (2) - for [P183] (3) - switch [P184] [P187] [P189] [P194] 178 [ ]; : : int var; : int var[3]; var 2293620 var[0] var[1] 2293620

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

untitled

untitled A, 3+A printf( ABCDEF ) 3+ printf( ABCDEF ) 2.1 C++ main main main) * ( ) ( ) [ ].* ->* ()[] [][] ** *& char (f)(int); ( ) (f) (f) f (int) f int char f char f(int) (f) char (*f)(int); (*f) (int) (

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1 21 , 7, Windows,,,, : 010-62782989 13501256678 13801310933,,,, ;,, ( CIP) /,,. : ;, 2005. 11 ( 21 ) ISBN 7-81082 - 634-4... - : -. TP316-44 CIP ( 2005) 123583 : : : : 100084 : 010-62776969 : 100044 : 010-51686414

More information

untitled

untitled MODBUS 1 MODBUS...1 1...4 1.1...4 1.2...4 1.3...4 1.4... 2...5 2.1...5 2.2...5 3...6 3.1 OPENSERIAL...6 3.2 CLOSESERIAL...8 3.3 RDMULTIBIT...8 3.4 RDMULTIWORD...9 3.5 WRTONEBIT...11 3.6 WRTONEWORD...12

More information

Ps22Pdf

Ps22Pdf ( 98 ) C ( ) ( )158 1998 C : C C C,,, C,, : C ( ) : : (, 100084) : : : 7871092 1/ 16 :18 25 :415 : 2000 3 1 2000 3 1 : ISBN 7 302 01166 4/ T P432 : 00016000 : 22 00 ( 98 ) 20 90,,, ;,,, 1994, 1998, 160,

More information

WWW PHP Comments Literals Identifiers Keywords Variables Constants Data Types Operators & Expressions 2

WWW PHP Comments Literals Identifiers Keywords Variables Constants Data Types Operators & Expressions 2 WWW PHP 2003 1 Comments Literals Identifiers Keywords Variables Constants Data Types Operators & Expressions 2 Comments PHP Shell Style: # C++ Style: // C Style: /* */ $value = $p * exp($r * $t); # $value

More information

华恒家庭网关方案

华恒家庭网关方案 LINUX V1.5 1 2 1 2 LINUX WINDOWS PC VC LINUX WINDOWS LINUX 90% GUI LINUX C 3 REDHAT 9 LINUX PC TFTP/NFS http://www.hhcn.com/chinese/embedlinux-res.html minicom NFS mount C HHARM9-EDU 1 LINUX HHARM9-EDU

More information

untitled

untitled 1 1.1 1.2 1.3 1.4 1.5 ++ 1.6 ++ 2 BNF 3 4 5 6 7 8 1.2 9 1.2 IF ELSE 10 1.2 11 1.2 12 1.3 Ada, Modula-2 Simula Smalltalk-80 C++, Objected Pascal(Delphi), Java, C#, VB.NET C++: C OOPL Java: C++ OOPL C# C++

More information

2013 C 1 # include <stdio.h> 2 int main ( void ) 3 { 4 int cases, a, b, i; 5 scanf ("%d", & cases ); 6 for (i = 0;i < cases ;i ++) 7 { 8 scanf ("%d %d

2013 C 1 # include <stdio.h> 2 int main ( void ) 3 { 4 int cases, a, b, i; 5 scanf (%d, & cases ); 6 for (i = 0;i < cases ;i ++) 7 { 8 scanf (%d %d 2013 18 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp, Compilation Error cin scanf Time Limit Exceeded 1: A 5 B 5 C 5 D 5 E 5 F 5 1 2013 C 1 # include 2 int main ( void ) 3 { 4 int cases, a, b,

More information

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha CYPOK CYPOK 1 UltraEdit Project-->Install Language Tool: Language Suite----->hi-tech picc Tool Name ---->PICC Compiler Executable ---->c:hi-picinpicc.exe ( Command-line Project-->New Project-->File Name--->myc

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2008 年 上 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 试 题 一 ( 共 15 分 ) 阅 读 以 下 说 明 和 流 程 图, 填 补 流 程 图 中 的 空 缺 (1)~(9), 将 解 答 填 入 答 题 纸 的 对 应 栏 内 [ 说 明

More information

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2 Chapter 02 變數與運算式 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.2.3 type 2.2.4 2.3 2.3.1 print 2.3.2 input 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 + 2.4.6 Python Python 2.1 2.1.1 a p p l e b e a r c 65438790

More information

Microsoft PowerPoint - OPVB1基本VB.ppt

Microsoft PowerPoint - OPVB1基本VB.ppt 大 綱 0.VB 能 做 什 麼? CH1 VB 基 本 認 識 1.VB 歷 史 與 版 本 2.VB 環 境 簡 介 3. 即 時 運 算 視 窗 1 0.VB 能 做 什 麼? Visual Basic =>VB=> 程 式 設 計 語 言 => 設 計 程 式 設 計 你 想 要 的 功 能 的 程 式 自 動 化 資 料 庫 計 算 模 擬 遊 戲 網 路 監 控 實 驗 輔 助 自 動

More information

21 16 () () () (),, :,,,,,,,,,,,, (CIP) /,. :, ISBN X... - : -. F CIP ( 2005 ) : ( 17, ) :

21 16 () () () (),, :,,,,,,,,,,,, (CIP) /,. :, ISBN X... - : -. F CIP ( 2005 ) : ( 17, ) : 21 21 16 () () () (),, :,,,,,,,,,,,, (CIP) /,. :, 2005. 8 21 ISBN 7-5623 - 2235 - X... - : -. F234. 4 CIP ( 2005 ) 073164 : ( 17, 510640) : 020-87113487 87111048 ( ) E - mail : scut202@ scut. edu. cn ht

More information

untitled

untitled 1 5 IBM Intel 1. IBM 第 1/175 页 第 2/175 页 第 3/175 页 80 第 4/175 页 2. IBM 第 5/175 页 3. (1) 第 6/175 页 第 7/175 页 第 8/175 页 = = 第 9/175 页 = = = = = 第 10/175 页 = = = = = = = = 3. (2) 第 11/175 页 第 12/175 页 第 13/175

More information

C/C++ - 结构体、共用体、枚举体

C/C++ - 结构体、共用体、枚举体 C/C++ Table of contents 1. 2. 3. 4. 5. 6. 7. 8. 1 C C (struct) C 2 C C (struct) C 2 i // book.c: # include < stdio.h> # define MAX_ TITLE 41 # define MAX_ AUTHOR 31 struct book { char title [ MAX_ TITLE

More information

( CIP. :, 2004. 10 / ISBN 7-5054 - 1005-9.......... D630. 3-44 CIP ( 2004 055306 35 100044 ( 010) 68433166 ( ) ( 010) 68413840 /68433213( ) ( 010) 884

( CIP. :, 2004. 10 / ISBN 7-5054 - 1005-9.......... D630. 3-44 CIP ( 2004 055306 35 100044 ( 010) 68433166 ( ) ( 010) 68413840 /68433213( ) ( 010) 884 , : :,, : ( CIP. :, 2004. 10 / ISBN 7-5054 - 1005-9.......... D630. 3-44 CIP ( 2004 055306 35 100044 ( 010) 68433166 ( ) ( 010) 68413840 /68433213( ) ( 010) 88415258( ) 787 1092 1 / 16 195 8 2004 10 1

More information

C

C C 14 2017 5 31 1. 2. 3. 4. 5. 2/101 C 1. ( ) 4/101 C C ASCII ASCII ASCII 5/101 C 10000 00100111 00010000 ASCII 10000 31H 30H 30H 30H 30H 1 0 0 0 0 0 ASCII 6/101 C 7/101 C ( ) ( ) 8/101 C UNIX ANSI C 9/101

More information

2015年计算机二级(C语言)模拟试题及答案(四)

2015年计算机二级(C语言)模拟试题及答案(四) 2016 年 计 算 机 二 级 (C 语 言 ) 模 拟 试 题 及 答 案 (4) 一 填 空 题 1 C 语 言 中 基 本 的 数 据 类 型 有 : 2 C 语 言 中 普 通 整 型 变 量 的 类 型 说 明 符 为, 在 内 存 中 占 字 节, 有 符 号 普 通 整 型 的 数 据 范 围 是 3 整 数 -35 在 机 内 的 补 码 表 示 为 4 执 行 下 列 语 句 int

More information

C, Win-TC Turbo C,, C, C,,,, C C, : Win-TC C, 23,,, 15,, C Turbo C Win-TC Turbo C,,,, 2005 1 W in -TC 1 Win-TC 1 1. Win-TC 1 2. Win-TC 1 3. Win-TC 1 2 Win-TC 3 1. 3 2. 3 3. 4 4. 4 5. 4 6. 4 7. 5 8. 5 9.

More information

CIP 1500 / ISBN X Ⅰ. Ⅱ. Ⅲ. Ⅳ. D CIP edu. cn

CIP 1500 / ISBN X Ⅰ. Ⅱ. Ⅲ. Ⅳ. D CIP edu. cn 1500 CIP 1500 /. 2006. 8 ISBN 7 5625 2128X Ⅰ. Ⅱ. Ⅲ. Ⅳ. D920. 5 44 CIP 2006 087648 1500 388 430074 027 87482760 027 87481537 E-mail cbb@cug. edu. cn 2006 8 1 2006 8 1 850 1 168 1 /32 8. 625 220 26. 00 1.

More information

第5章修改稿

第5章修改稿 (Programming Language), ok,, if then else,(), ()() 5.0 5.0.0, (Variable Declaration) var x : T x, T, x,,,, var x : T P = x, x' : T P P, () var x:t P,,, yz, var x : int x:=2. y := x+z = x, x' : int x' =2

More information

bingdian001.com

bingdian001.com TSM12M TSM12 STM8L152C6, STM8L152R8 MSP430F5325 whym1987@126.com! /******************************************************************************* * : TSM12.c * : * : 2013/10/21 * : TSM12, STM8L f(sysclk)

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

EK-STM32F

EK-STM32F STMEVKIT-STM32F10xx8 软 件 开 发 入 门 指 南 目 录 1 EWARM 安 装... 1 1.1 第 一 步 : 在 线 注 册... 1 1.2 第 二 步 : 下 载 软 件... 2 1.3 第 三 步 : 安 装 EWARM... 3 2 基 于 STMEVKIT-STM32F10xx8 的 示 例 代 码 运 行... 6 2.1 GPIO Demo... 6 2.2

More information

Microsoft Word - 财务d08z.doc

Microsoft Word - 财务d08z.doc 版 权 所 有 侵 权 必 究 图 书 在 版 编 目 (CIP) 数 据 用 好 Excel(2007 版 ): 财 务 篇 / 王 维, 云 大 勇 编 著. 北 京 : 中 国 宇 航 出 版 社,2007.5 ( 时 尚 IT 生 活 秀 ) ISBN 978-7-80218-208-0 Ⅰ. 用 Ⅱ.1 王 2 云 Ⅲ. 电 子 表 格 系 统,Excel Ⅳ.TP391.13 中 国 版

More information

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un

1 LINUX IDE Emacs gcc gdb Emacs + gcc + gdb IDE Emacs IDE C Emacs Emacs IDE ICE Integrated Computing Environment Emacs Unix Linux Emacs Emacs Emacs Un Linux C July 27, 2016 Contents 1 Linux IDE 1 2 GCC 3 2.1 hello.c hello.exe........................... 5 2.2............................... 9 2.2.1 -Wall................................ 9 2.2.2 -E..................................

More information

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10

1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 Java V1.0.1 2007 4 10 1 4 1.1 4 1.2..4 2..4 2.1..4 3.4 3.1 Java.5 3.1.1..5 3.1.2 5 3.1.3 6 4.6 4.1 6 4.2.6 5 7 5.1..8 5.1.1 8 5.1.2..8 5.1.3..8 5.1.4..9 5.2..9 6.10 6.1.10 6.2.10 6.3..10 6.4 11 7.12 7.1

More information

Microsoft Word - PHP7Ch01.docx

Microsoft Word - PHP7Ch01.docx PHP 01 1-6 PHP PHP HTML HTML PHP CSSJavaScript PHP PHP 1-6-1 PHP HTML PHP HTML 1. Notepad++ \ch01\hello.php 01: 02: 03: 04: 05: PHP 06:

More information

Ps22Pdf

Ps22Pdf ( ) ,,,,,,,,,,, (CIP). () /. 2 :, 2003. 9 ISBN 7-81045 - 824-8... - : -. G723.4 - CIP (2001)029424 / / 5 / 100081 / (010 ) 68914775 () 68912824 ( ) / http:/ / www. bitpress. com. cn / chiefedit @bitpress.

More information

:,,,,,,, ( CIP) /,. :, 2002. 8 ISBN 7-5624-2708-9............ :. F590. 63 CIP ( 2002) 062616 : : * : : : : 174 ( A ) : 400044 : ( 023) 65102378 651057

:,,,,,,, ( CIP) /,. :, 2002. 8 ISBN 7-5624-2708-9............ :. F590. 63 CIP ( 2002) 062616 : : * : : : : 174 ( A ) : 400044 : ( 023) 65102378 651057 :,,,,,,, ( CIP) /,. :, 2002. 8 ISBN 7-5624-2708-9............ :. F590. 63 CIP ( 2002) 062616 : : * : : : : 174 ( A ) : 400044 : ( 023) 65102378 65105781 : ( 023) 65103686 65105565 : http: / / www. cqup.

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

概述

概述 OPC Version 1.6 build 0910 KOSRDK Knight OPC Server Rapid Development Toolkits Knight Workgroup, eehoo Technology 2002-9 OPC 1...4 2 API...5 2.1...5 2.2...5 2.2.1 KOS_Init...5 2.2.2 KOS_InitB...5 2.2.3

More information

<4D F736F F D D342DA57CA7DEA447B14D2DA475B57BBB50BADEB27AC3FEB14DA447B8D5C344>

<4D F736F F D D342DA57CA7DEA447B14D2DA475B57BBB50BADEB27AC3FEB14DA447B8D5C344> 1. 請 問 誰 提 出 積 體 電 路 (IC) 上 可 容 納 的 電 晶 體 數 目, 約 每 隔 24 個 月 (1975 年 更 改 為 18 個 月 ) 便 會 增 加 一 倍, 效 能 也 將 提 升 一 倍, 也 揭 示 了 資 訊 科 技 進 步 的 速 度? (A) 英 特 爾 (Intel) 公 司 創 始 人 戈 登. 摩 爾 (Gordon Moore) (B) 微 軟 (Microsoft)

More information

( CIP ) /. :, 2003 ISBN I247.5 CIP (2003) : : : ( 310 ) : : : mm mm 1/ 32 : : : :1 - : ISBN :3

( CIP ) /. :, 2003 ISBN I247.5 CIP (2003) : : : ( 310 ) : : : mm mm 1/ 32 : : : :1 - : ISBN :3 ( CIP ) /. :, 2003 ISBN 7-80647 - 579-6......... - -. I247.5 CIP (2003) 121754 : : : ( 310 ) : : : mm mm 1/ 32 : : : :1 - : ISBN7-7 - 80647-579 - 6 :330006 (, ) ,,,,, ;,,,,,,,, 1 ,,,,, ;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,?,?,?,,

More information

untitled

untitled 1 7 7.1 7.2 7.3 7.4 7.5 2 7.1 VFT virtual 7.1 3 1 1. 2. public protected public 3. VFT 4. this const volatile 4 2 5. ( ) ( ) 7.1 6. no-static virtual 7.2 7. inline 7.3 5 3 8. this this 9. ( ) ( ) delete

More information

WWW PHP

WWW PHP WWW PHP 2003 1 2 function function_name (parameter 1, parameter 2, parameter n ) statement list function_name sin, Sin, SIN parameter 1, parameter 2, parameter n 0 1 1 PHP HTML 3 function strcat ($left,

More information

Microsoft PowerPoint - ds-1.ppt [兼容模式]

Microsoft PowerPoint - ds-1.ppt [兼容模式] http://jwc..edu.cn/jxgl/ HomePage/Default.asp 2 说 明 总 学 时 : 72( 学 时 )= 56( 课 时 )+ 16( 实 验 ) 行 课 时 间 : 第 1 ~14 周 周 学 时 : 平 均 每 周 4 学 时 上 机 安 排 待 定 考 试 时 间 : 课 程 束 第 8 11 12 章 的 内 容 为 自 学 内 容 ; 目 录 中 标 有

More information

Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp

Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp 01 1.6 Spyder Anaconda Spyder Python Spyder Python Spyder Spyder 1.6.1 Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Spyder Python File

More information

Progperl.PDF

Progperl.PDF print "Howdy, world!\n"; 1 2 / / 3 4 / $phrase = " Howdy, world!\n"; print $phrase ; # # / 5 6 / $answer = 42; $pi = 3.14159265; $avocados = 6.02e23; $pet = "Camel"; $sign = "I love my $pet"; $cost = 'It

More information

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004

More information

第7章-并行计算.ppt

第7章-并行计算.ppt EFEP90 10CDMP3 CD t 0 t 0 To pull a bigger wagon, it is easier to add more oxen than to grow a gigantic ox 10t 0 t 0 n p Ts Tp if E(n, p) < 1 p, then T (n) < T (n, p) s p S(n,p) = p : f(x)=sin(cos(x))

More information

untitled

untitled Fortran Chapter 7 Subroutine ( ) and Function 7-1 subroution 行 不 行 來 行 The general form of a subroutine is subroutine subroutine_name ( argument_list) (Declaration section) (Execution section) retrun end

More information

untitled

untitled 1 Outline 流 ( ) 流 ( ) 流 ( ) 流 ( ) 流 ( ) 狀 流 ( ) 利 來 行流 if () 立 行 ; else 不 立 行 ; 例 sample2-a1 (1) 列 // 料 Console.Write(""); string name = Console.ReadLine(); Console.WriteLine(" " + name + "!!"); 例 sample2-a1

More information

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM CHAPTER 6 SQL SQL SQL 6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM 3. 1986 10 ANSI SQL ANSI X3. 135-1986

More information

(CIP) : /. :, 2004 ISBN T S CIP (2004) (1 : ) : * : : :

(CIP) : /. :, 2004 ISBN T S CIP (2004) (1 : ) : * : : : (CIP) : /. :, 2004 ISBN 7 5045 4510 4.... T S974. 2 CIP (2004) 044759 (1 : 100029 ) : * 787 1092 16 8. 25 176 2004 6 1 2004 6 1 : : 15. 00 : 010 64929211 : 010 64911190 : http: / / www. class. com. cn

More information

( ) A B C D ( ) A B C D A B C D A B C D A 8750 B C 6250 D 5000 A B C D A B C D

( ) A B C D ( ) A B C D A B C D A B C D A 8750 B C 6250 D 5000 A B C D A B C D 1 A B C D A B C D A B C D 1000 1200 900 A B C D ( ) A B C D ( ) A B C D A B C D A B C D 5000 6250 A 8750 B 11250 C 6250 D 5000 A B C D A B C D A B C D 1 200000 400 10 A 1000 B 1600 C 2000 D 2300 1 A B

More information

FZUBRIDGE

FZUBRIDGE 1 2 3 5 8 9 10 11 12 13 14 15 16 17 19 20 21 23 24 25 29 31 32 33 34 M g1 M 1g ( M 2g M 1g )(1 e ( t, ) ) 35 36 M Q M Q g g 1.15M 1.05Q p p 37 max 1 n e max n i1 1 2 i 38 39 n max M Q M Q g g

More information

( CIP) : /,. :, 2003.10 ISBN 7-81079 - 314-4.... F127 CIP (2003) 092358 : : : (8620) 85226521 85226593 85221601 (8620) 85225284 85228291 85220602 ( )

( CIP) : /,. :, 2003.10 ISBN 7-81079 - 314-4.... F127 CIP (2003) 092358 : : : (8620) 85226521 85226593 85221601 (8620) 85225284 85228291 85220602 ( ) ( CIP) : /,. :, 2003.10 ISBN 7-81079 - 314-4.... F127 CIP (2003) 092358 : : : (8620) 85226521 85226593 85221601 (8620) 85225284 85228291 85220602 ( ) : (8620) 85221583 ( ) 85223774 ( ) : 510630 : http:

More information

图书在版编目 CIP 数据 李济深与苍梧故居 / 民革中央宣传部编. -- 北京 团结出版社 2013.6 ISBN 978-7-5126-1916-6 Ⅰ. ①李 Ⅱ. ①民 Ⅲ. ①李济深 1885~1959 传记②名人 故居 介绍 苍梧县 Ⅳ. ① K827=7②K878.2 中国版本图书馆C

图书在版编目 CIP 数据 李济深与苍梧故居 / 民革中央宣传部编. -- 北京 团结出版社 2013.6 ISBN 978-7-5126-1916-6 Ⅰ. ①李 Ⅱ. ①民 Ⅲ. ①李济深 1885~1959 传记②名人 故居 介绍 苍梧县 Ⅳ. ① K827=7②K878.2 中国版本图书馆C 丛书编委会 总 顾 问 周铁农 万鄂湘 齐续春 顾 问 朱培康 卞晋平 常荣军 尚明轩 编委会主任 修福金 编委会委员 程崇庆 傅惠民 周天鸿 刘新文 高小玫 夏 涛 李晓东 吴先宁 丛 书 主 编 王秉默 执 行 委 员 刘则永 刘玉霞 金绮寅 1 图书在版编目 CIP 数据 李济深与苍梧故居 / 民革中央宣传部编. -- 北京 团结出版社 2013.6 ISBN 978-7-5126-1916-6

More information

untitled

untitled 2006 6 Geoframe Geoframe 4.0.3 Geoframe 1.2 1 Project Manager Project Management Create a new project Create a new project ( ) OK storage setting OK (Create charisma project extension) NO OK 2 Edit project

More information

Ps22Pdf

Ps22Pdf / : : : / : ISBN 7-81055 - 930-7 / F 313 : 5. 00 : 2006 4 1 CIP ( 2006) 045879 ;, ;, ( ), :,, :, ;, ; 1 , ; :,, :,,,??,? ;,?,??,? 2 ? ;,,,! ;, ;,, ;,,, : ;,, 3 ?,,,,,,, ;,, 4 , ;, ;!, ;,, 5 , :, :, - :?

More information

untitled

untitled MPICH anzhulin@sohu.com 1 MPICH for Microsoft Windows 1.1 MPICH for Microsoft Windows Windows NT4/2000/XP Professional Server Windows 95/98 TCP/IP MPICH MS VC++ 6.x MS VC++.NET Compaq Visual Fortran 6.x

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション Perl CGI 1 Perl CGI 2 Perl CGI 3 Perl CGI 4 1. 2. 1. #!/usr/local/bin/perl 2. print "Content-type: text/html n n"; 3. print " n"; 4. print " n"; 3. 4.

More information

2, :,,,,,, : 010-62782989 13501256678 13801310933,,,, ;,, (CIP) /. : ;, 2005. 9 ( ) ISBN 7-81082 - 608-5... - - - -. F715. 4 F713. 3 CIP ( 2005 ) 1008

2, :,,,,,, : 010-62782989 13501256678 13801310933,,,, ;,, (CIP) /. : ;, 2005. 9 ( ) ISBN 7-81082 - 608-5... - - - -. F715. 4 F713. 3 CIP ( 2005 ) 1008 2, :,,,,,, : 010-62782989 13501256678 13801310933,,,, ;,, (CIP) /. : ;, 2005. 9 ( ) ISBN 7-81082 - 608-5... - - - -. F715. 4 F713. 3 CIP ( 2005 ) 100852 : : : 100084 : 010-62776969 ht tp :/ / www.tup.com.cn

More information

( CIP ) /. - :, ( ) ISBN , -. K CIP ( 1999 ) * ( 6 ) : * ISBN :

( CIP ) /. - :, ( ) ISBN , -. K CIP ( 1999 ) * ( 6 ) : * ISBN : ( CIP ) /. - :, 1999.10 ( ) ISBN 7-200 - 03791-5..., -. K892. 41 CIP ( 1999 ) 32680 * ( 6 ) : 100011 * 199 1 199 1 ISBN : 1997 2 10, :, :,,,,,,,,,,,, 1984,,,,,,, 1 ,,?,, 2 ( 1 ) ( 3 ) 1. ( 3 ) 2. ( 7 )

More information

C 1 # include <stdio.h> 2 int main ( void ) { 4 int cases, i; 5 long long a, b; 6 scanf ("%d", & cases ); 7 for (i = 0;i < cases ;i ++) 8 { 9

C 1 # include <stdio.h> 2 int main ( void ) { 4 int cases, i; 5 long long a, b; 6 scanf (%d, & cases ); 7 for (i = 0;i < cases ;i ++) 8 { 9 201 201 21 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 1 B 1 C 5 D RPG 10 E 10 F 1 G II 1 1 201 201 C 1 # include 2 int main ( void

More information

Ps22Pdf

Ps22Pdf A B C D A B C D A B C D a a b c x x x x x x x x x x x x x x x x x a b c x a x x x x x x x x x x a b a b a b x x x x x x x x x x x x A B C A B C A B A B A x B C x D A B C a b c a b x x x x x x x A B A

More information