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. 5 10. HTML 5 3 Win-TC 6 1. 6 2. 6 3. 6 4. 7 5. 7 6. 7 7. 7 8. 8 9. 8 4 12 1. 12
2. 12 3. 13 4. 13 5 Win-TC 16 1. ASCII 16 2. 17 3. DOS 18 4. / / / * * / 19 5. LIB 19 6 Win-TC 21 C 1 Win-TC 22 2 23 3 25 4 1 27 5 2 29 6 1 30 7 2 31 8 3 31 9 4 32 10 33 11 34 12 34 13 35 14 37 15 39 16 40 17 42 18 43 19 44 20 46 21 49 22 49
23 50 C 1 52 2 56 3 59 4 61 5 67 6 76 7 81 8 85 9 86 10 91 11 93 12 99 13 103 14 113 15 127 1 C 137 2 Turbo C 141 3 200 3
W in -TC 1 Win-TC 1. Win-T C ( 1 ) Win-TC, : Pentium133 CPU 32MB ( 64MB, 4GB) 2 GB, 850MB Win98 /Win2000 / Win XP ( 2 ) Windows Win-TC18, 2. Win-T C ( 1 ) Win-TC : Win-TC : ( ) Win-TC ( 2 ) Win-TC : Win-TC : : Alt + F4 : : 3. Win-TC Win-TC, 1. 1
1. 1 Win-TC ( 1 ),, noname. c ( 2 ) Win-TC 5,, Win-TC 1. 2 ( 3 ) Win-TC, ( 4 ), Win-TC, ( 5 ), ( 6 ), ( 7 ),
Win-TC 1. 2 Win-TC 2 Win-TC 1. : : Ctrl + N : 2. 3 :
: Ctrl + O : 3. ( 1 ) : : Ctrl + S : ( 2 ) : 4. ( 1 ) : : ( 2 ) BGI ( ) : BGI : BGI 5. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 6. ( 1 ) Win-TC :
Win-TC : ( 2 ) Windows : Windows ( ) 7. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 8. ( 1 ) Win-TC : : ( 2 ) Windows : Windows ( ) 9. ( 1 ) Win-TC :... :... ( 2 ) Windows : Windows ( ) 10. HTML 5 : HTML
3 Win-TC 1. Win-TC,, ( 1 ) : ( ), ( ),,, ( 2 ) : ( ),, Shift ( ) :, Shift,,, ( 3 ) : Ctrl + A : :,, 2.,, : : : Ctrl + C : 3.,, :
Win-TC : : Ctrl + X : 4. ( ),, Del : 5.,, : : : Ctrl + P : 6. ( ), ( ), : ( ) : trl + F( ) : ( ) 7. ( ), ( ), : ( ) ( ) 7
: ( ) ( ) 8.,,, :, 9. ( ), Win-TC : 3. 1 3. 1
Win-TC ( 1 ) : : 3232, : 1616, Win-TC, : 4, 0 9999 0: N, 0 N 4,, 0001, 1 Win-TC noname. c : Win-TC project noname. c : : Win-TC,, C : 99,, 999 :, ( pixel) ( 2 ) ( ) ( 3. 2 ), ; ( ) ; 9
3. 2 ( ) ( ) 1024768,, Win-TC ( 3 ) ( 3. 3 ), VC, VC TAB, TAB ( TAB ) Win-TC,, 4
Win-TC 3. 3 ( 4 ) ( 3. 4 ) 11 3. 4
,,. tpl, Win-TC, :,, 4 1. ( ),, ( ), ( obj ) ( exe ),,, : : F9 :, ;,,,, 4. 1 ; 4. 2 2., ( exe ), : : Windows
Win-TC 4. 1 4. 2 : : Win-TC : : Ctrl + F9 : 3., : 4., : 4. 3, 5, ( 1 ), 6 :, 64K,, CS = DS = SS = ES near.exe DOS EXE2 BIN.COM : 64K, 64K 13
4. 3, DS = SS = ES near : 64K, near 64K( 1M), far : 64K, far 64K, near, 64K, far : far, 1MB, 64K : far,,, Turbo C 64K, 64K
( 2 ) : : : : ( 3 ) Win-TC Turbo C 2 Turbo C 2. 01 Turbo C 2 : Turbo C 2, Turbo C 2. 01 : Turbo C 2. 01, ( 4 ) FOR Turbo C 2 LIB LIB, LIB,, 10 LIB, LIB Win-TC ( 5 ) : / * * /, : / * aa / * bb * / cc * / :,, ASM,. exe. obj. exe, Obj : C. obj Map : C. map :, :,, / / : 15
:,, 5 Win-TC 1. ASCII Win-TC ASCII, ASCII ASCII : Alt + ASCII ASCII : ASCII ASCII 5. 1 5. 1 ASCII
Win-TC 2. Win-TC,, EXE ( 5. 2 ),, 5. 2 1212 1616 DOS, 16 16, 6, : void drawmat( char * mat, int matsize, int x, int y, int color) / * : ( x, y) * / { nt i, j, k, n; n = ( matsize - 1) /8 + 1 ; for( j = 0; j < matsize; j + + ) for( i = 0; i < n; i + + ) for( k = 0; k < 8; k + + ) if( mat[ j* n + i] &( 0x80 > > k) ) / * 1 * / 17
putpixel( x + i* 8 + k, y + j, color) ; 3. DOS : CCDOS, PDOS95, Windows 98 PDOS95 DOS Windows 2000 Windows XP, PDOS95 DOS, UCDOS, Win-TC DOS, DOS DOS, DOS DOS,, EXE ( 5. 3 ) DOS,,, DOS,, DOS, 32 PE 16 NE,, DOS EXE 5. 3 DOS
Win-TC 4. / //* * / Win-TC C + +, / / Win- TC / / / /, #include / /, #include/ /,, / /, /* * / TC2 TC2, / // * * // / / * * /, TC2 5. LIB ( 1 ) Turbo C,, Win-TC, ( LIB) LIB FOR Turbo C FOR Visual C FOR Turbo C, (, *. h ) Win-TC include, *. lib lib, Win-TC, LIB,, ( 2 ) LIB LIB LIB? : ( OBJ) mylib / * * * * * mylib. c * * * * * / void myfun( ) { printf( \ nmyfun( ) in mylib. lib \ n ) ; Win-TC mylib. c OBJ,, 19
, ( F9 ) : LIB ( LIB) Win-TC mylib. obj Win-TC BIN, makelib. bat, : Tlib mylib. lib + mylib. obj, BIN mylib. lib : ( *. h) LIB BIN mylib. lib Win-TC lib mylib. lib,, : Win-TC, :void myfun( ) ;, #ifndef... #define... #endif, MYLIB, : #ifndef #define MYLIB MYLIB void myfun( ) ; #endif,, ( *. h), Win-TC INCLUDE,, mylib, INCLUDE mylib. h : LIB : #include mylib. h / * * / { yfun( ) ; getch( ) ; Ctrl + F9, : myfun( ) in mylib. lib, LIB
Win-TC 6 Win-TC ; ( ; ) ;, ; 1 Win 2000 Win XP Win-TC Win 2000 Win XP,,, getch( ), { printf( This is a TurboC. ) ; : { printf( This is a TurboC. ) ; getch( ) ;, :, 21
C 1 Win -TC 1. C 2. Win-TC 3. C 1. Win-TC, Win-TC 2. Win-TC 3. Win-TC, Win-TC 4. Win-TC 5. Win-TC 6. Win-TC 7. : #include stdio. h { printf( This is C program! ) ; ( 1 ) ( 2 ), ( 3 ), : I am a student! ( 4 ), : I am a student!
C 2 1. C 2. C 3. C 1. ( 1 ) printf( % d, 2 /3) ; ( 2 ) printf( % f, 2. 0 /3) ; ( 3 ) printf( % d, 2 /3* 100) ; ( 4 ) printf( % f, 2. 0 /3* 100) ; ( 5 ) printf( % d, 2 / ( 3* 100) ) ; ( 6 ) printf( % f, 2. / ( 3* 100) ) ; ( 7 ) printf( % d, 2. / ( 3* 100) ) ; ( 8 ) printf( % d, 2% 3) ; ( 9 ) printf( % d, 3% 2) ; ( 10) printf( % d, 3. 0% 2 ) ; 2. ( 1 ) = 3; j = 3 ; j = ( i + + ) + ( i + + ) + ( i + + ) ; printf( i = % d, j = % d, i, j) ; ( 2 ) = 3; j = 3 ; j = ( + + i) + ( + + i) + ( + + i) ; printf( i = % d, j = % d, i, j) ; ( 3 ) = 3; printf( a = % d \n, a) ; printf( a = % d \ n, a + + ) ; printf( a = % d \ n, + + a) ; 23
( 4 ) printf( % d, 1234567. 89) ; ( 5 ) printf( % ld, 1234567. 89) ; ( 6 ) printf( % f, 1234567. 89) ; ( 7 ) printf( % 12. 4f, 1234567. 89) ; 3. ( 1 ) printf( % d, + + 4) ; ( 2 ) i = 3; j = 4 ; printf( % d, + + ( i + j) ) ; ( 3 ) i = 3; printf( % d, + + i + + ) ; ( 4 ) i = 3; printf( % d, + + + + i) ; ( 5 ) printf( % d, 5. 0% 3) ; ( 6 ) printf( % d, 5. 0% 3. 0) ; 4. ( 1 ) x = 4; x = 4 * 6, x* 5; x? ( 2 ) x = 4; x = ( 4* 6, x* 5 ) ; x? ( 3 ) a = 12; a + = a - = a* = a; a? ( 4 ) z = 7; z = 3 * z - - ; z? 5. ( 1 ) { nt i, j, m, n; i = 8; j = 10; m = i + + ; n = + + j; printf( % d, % d, % d, % d, i, j, m, n) ; 5 6 m = + + i; n = j + + ;? ( 2 ) define AMT a + a + a #define ATT AMT - AMT { nt a = 2; printf( % d, ATT) ;
C 3 1. C 2. printf( ) 3. scanf( ) 4. putchar( ) getchar( ) 1. : #include stdio. h { har m = 97, n; n = getchar( ) ; putchar( m) ; putchar( n) ; ( 1 ) ( 2 ) 1,? 2. : { nt a = - 1; printf( % d, a) ; printf( % u, a) ; ( 1 ) ( 2 ) a = - 2,?? 3. : { nt a = 20; 25
printf( % d, a) ; printf( % o, a) ; printf( % x, a) ; ( 1 ) ( 2 ) a = - 2,?? 4. : { nt a = 20; float b = 12. 3456 ; printf( % - 5d#, % d* % 06. 2f, a, a, b) ; 5. : { nt a; float b; scanf( %, % d, a, b) ; printf( % d* % d, a, b) ; ( 1 ), ( 2 ) 4 : scanf( % o, % f, a, b) ;, 6. : { nt a, b; scanf( % 2d% * 3d% 2 d, &a, &b) ; printf( % d* % d, a, b) ; ( 1 ), 1234567, ( 2 ) 3 : scanf( % 3d% 3d, &a, &b) ;,?
C 1.,? 2. printf( ) scanf( ) 4 1 1. if if... else... 2. 3. 1. ( 1 ) nt a; a = 5 > 3; printf( % d, a) ; ( 2 ) printf( % d,! 9) ; ( 3 ) nt a = 1, b = 2, c = 3, d = 4, m, n = 1; ( m = a > b) &&( n = c > d) ; printf( m = % d, n = % d, m, n) ; 2., { nt x = 1, y = 1, z = 1; y = y + z; x = x + y; printf( % d \ n, x < y? y: x) ; printf( % d \ n, x < y? x + + : y + + ) ; printf( % d \ n, x) ; printf( % d \ n, y) ; 27
x = 3; y = z = 4; printf( % d \ n, x > = y > = x? 1: 0) ; printf( % d \ n, z > = y&&y > = x) ; 3., ( 1 ) ain( ) { nt x; if x = 2) el e ( 2 ) ain( ) printf( all right! ) ; printf( it is wrong! ) ; { nt x; scanf( % d, &x) ; if( 2) else ( 3 ) ain( ) printf( all right! ) ; printf( it is wrong! ) ; { nt x = 3, y = 4, z = 5, ; if x < z) el e printf( % d, x + + ) ; if( y < z) else printf( % d, + + y) ; printf( % d, + + z) ; 4. ax 2 + bx + c = 0 : 1) a = 0,, x = - c / b ( 2) a = b = 0,
C ( 3) a0 : b 2-4ac > 0, ; b 2-4ac = 0, ; b 2-4ac < 0, 5. 3 a, b, c, : 1) a, b, c 0, ; ( 2), ; ( 3), ; ( 4) area = s( s - a) ( s - b) ( s - c), s = ( a + b + c) /2 6. : x 2-1, x < 0, y = 0, x = 0, x 2 + 1, x > 0, y, x 5 2 switch 1., { int x = 1, y = 0 ; switch( x) { case 1 : switch( y) { case 0 : rintf( * * 1* * \ n ) ; break; 29
, : case 1: printf( * * 2* * \n ) ; break; case 2: printf( * * 3 * * \ n ) ; 2.,, s s > 100, 95 ; s > 300, 90 ; s > 500, 80 ; s > 1 000, 75 ; s > 3 000, 70 switch( ) if... else..., 6 1 while( ) 1., { int a = 1, b = 2, c = 2, t; while( a < b < c) { t = a; a = b; b = t; c - - ; printf( % d, % d, % d, a, b, c) ; 2. m n, 3. s = 1! + 2! + 3! + + 20!
C 7 2 do... while( ) ) 1., { nt x = 0, y = 0 ; do { y + + ; x + = + + y; while( x < 18 ) ; printf( % d, % d, x, y) ; 2. 5 100 5 7 ( 3. s = 2 + 4 + 8 + + n ( n = 3 200 ) 8 3 for 1., { nt x = 1, y = 2, z = 3; for( ; < = 105; x + +, y + + ) 31
z = x* y* z; printf( % d, % d \n, x, y) ; 2. e, 10-6 e = 1 + 1 /1! + 1 /2! + + 1 / n! 3.,,, 128,,,,,,,,,,, 64,,,,,,, 1,,,,, C, 9 4 continue break 1. break, s = 2 + 4 + 6 + + 100 2. continue, 1 100 3. 5, :,,,? 1. 2.?
C 3.,? 4.,? 10 1. 2. 3. 1., #include stdio. h { nt i, c[ 5 ] ; int a[ ] = {9, 7, 5, 3, 1 ; int b[ ] = { - 2, - 4, - 6, - 8, - 10 ; f r( i = 0 ; i < 5; i + + ) c[ i] = a[ i] + b[ i] ; for( i = 0; i < 5 ; i + + ) printf( % 8d, c[ i] ) ; 2. 40, 3. 10 ( ) 4. 10 5. 33
11 1. 2. 1., #include stdio. h { nt a[ 3] [ 3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, i, x = 0 ; for( i = 0; i < = 2 ; i + + ) x + = a[ i] [ i] ; printf( % d \ n, x) ; 2. 55 3., (, ) 4. ( 9 ) : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 12 1.
C 2. 1., #include stdio. h { har a[ ] = { a, b, c, d, \0, x, y, z, \0 ; printf( % s, a) ; 2. #include stdio. h { har a[ 5 ], b[ 5] ; int i; for( i = 0; i < 5 ; i + + ) scanf( % c, a[ i] ) ; scanf( % s, b[ i] ) ; printf( % s\ n% s \n, a, b) ; 3. ( * ) * * * * * * * * * * * * * * * * * * * * * * * * * 13 1. 2. 3. 35
1., #include stdio. h int fun1( ) { int x = 5; printf( % d \ t, x) ; return x; int fun2( int x) { printf( % d \ t, + + x) ; return x; { int x = 2; x = fun1( ) ; x = fun2( x) ; printf( % d \ n, x) ; 2.,, #include stdio. h { nt x = 4, y = 2 ; printf( % d \ n, mm( x* y) ) ; int mm( u, v) { int u, v; return( u* v) ; 3., f( x) = x 2 + 1, x > 1, x 2, - 1x1, x 2-1, x < - 1 double fun( double x)
C 4. ax 2 + bx + c = 0, b 2-4ac 0 0 0 a, b, c 5. n! ( n = 10) n! = 1, n = 1, ( n - 1)!n, n > 1 6. n, : 1, n = 0, P n ( x) = x, n = 1, [ ( 2 n - 1) x - P n - 1 ( x) - ( n - 1) P n - 2 ( x) ] /n, n > 1 14 1. 2. 1., ( 1 ) include stdio. h void fun1( ) { nt x = 5; printf( % d \ t, x) ; void fun2( int x) { printf( % d \ t, + + x) ; { nt x = 2; fun1( ) ; fun2( x) ; 37
printf( % d \ n, x) ; ( 2 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( int x) { = x + + ; printf( % d \ n, y) ; ( 3 ) include stdio. h int x, y; { = 5 ; f( ) ; f( ) ; getch( ) ; int f( ) { = x + + ; printf( % d \ n, y) ; ( 4 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( ) { = x + + ; printf( % d \ n, y) ;
C ( 5 ) include stdio. h int x, y; { = 5 ; f( x) ; f( x) ; getch( ) ; int f( x) { = x + + ; printf( % d \ n, y) ; 15 1. 2. 3. 1., #define MAX( a, b) ( ( a) > ( b)?( a) : ( b) ) 2., ( a) > ( b),?? 3., 4., f1. c, #define MAX( a, b) ( ( a) > ( b)?( a) : ( b) ) #include stdio. h 1, #include f1. c, 39
, 5., #define LETTER 1 { har str[ 20] = C language, c; int i; i = 0; while( ( c = str[ i] )! = \0 ) { i + + ; #if LETTER #else #endif printf( % c, c) ; if( c > = a &&c < = z ) c = c - 32; if( c > = A &&c < = Z ) c = c + 32; 16 1. 2. 1. #include stdio. h { nt a; int * p; p = &a; scanf( % d, &a) ;
printf( % d \ n, a) ; C :, 2., #include stdio. h / * 3, * / { nt a, b, c; int * p1, * p2, * p3; scanf( % d, % d, % d, &a, &b, &c) ; p1 = &a; p2 = &b; p3 = &c; if( a > b) swap( p1, p2) ; if( a > c) swap( p1, p3) ; if( b > c) swap( p2, p3) ; printf( % d, % d, % d, a, b, c) ; swap( int * p1, int * p2) { nt x; ( 1 ), ( 2 ) : swap *,?? 3., #include stdio. h sub( int x, int y, int * z) { * z = y - x; { nt a, b, c; sub( 10, 5, &a) ; sub( 7, a, &b) ; sub( a, b, &c) ; printf( % 4d, % 4 d, % 4d \ n, a, b, c) ; 41
17 1. 2. 3. 1. : int a[ 10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, i = 0; int * p; ( 1 ) p? ( 2 ) 2. p,? ( 1 ) * p; ( 2 ) * ( p + + ) ; ( 3 ) * p + + ; ( 4 ) * ( p + + ) * ( + + p), * ( p + + ) a [ i + + ]? 3. : 10,, { nt number[ 10 ] ; int * p, i; printf( input 10 numbers: ) ; fo ( i = 0 ; i < 10; i + + ) scanf( % d, &number[ i] ) ; maxminvalue( number) ; printf( New order: ) ;
C for( p = number; p < = number + 9; p + + ) printf( % d, * p) ; maxminvalue( int array[ 10] ) { nt * max, * min, * p, * end; end = array + 9; max = min = array; for( p = array + 1; p < = end; p + + ) if( * max < * p) max = p; * p = array[ 9] ; array[ 9] = * max; * max = * p; f r p = array + 1; p < = end; p + + ) if * min > * p) min = p; return; 18 1. 2. 1., 33, { nt a[ 3] [ 3], * p, i; printf( input matrix: \ n ) ; for( i = 0; i < 3 ; i + + ) scanf( % d% d% d, &a[ i] [ 1], &a[ i] [ 2 ], &a[ i] [ 3] ) ; p = &a[ 0] [ 0] ; 43
for( i = 0; i < 3 ; i + + ) for( j = 0; j < 3 ; j + + ) = * ( p + 3* i + j) ; * ( p + 3 * i + j) = * ( p + 3* j + i) ; * ( p + 3 * j + i) = t; printf( New matrix: \n ) ; for( i = 0; i < 3 ; i + + ) printf( % d% d% d \ n, a[ i] [ 0], a[ i] [ 1], a[ i] [ 2] ) ; 2., 19 1. 2. 1. #include stdio. h #include string. h chnum( char * p) { nt num = 0 ; fo ( ; * p! = \0 ; p + + ) num = num* 10 + * p- 0 ; return( num) ; { har s[ 8 ] ;
C int n; gets( s) ; if( * s = = - ) n = - chnum( s + 1) ; else n = chnum( s) ; printf( % d \ n, n) ; ( 1 ) - 2345 < >,? ( 2 ) 2345 < >,? 2. strcmp( ), #include stdio. h { nt n; char s1[ 10], s2[ 10 ] ; char * p, * q; printf( input 2 strings: \ n ) ; gets( s1) ; gets( s2) ; p = s1; q = s2; n = strcmp( p, q) ; printf( result: % d \n, n) ; nt strcmp( char * p, char * q) { nt i = 0, m; while( * ( p + i) = = * ( q + i) ) { f( break; i + + ; m = * ( p + i) - * ( q + i) ; return( m) ; ( 1 ) rechard < > rechard < >,? ( 2 ) rechard < > heland < >,? 45
( 3 ) heland < > rechard < >,? ( 4 ), 20 1. 2. 1. :, #include stdio. h stru t yymmdd { nt day; int month; int year; data; { nt days( int, int, int) ; int i, daysum; printf( please input year - month - day: ) ; scanf( % d, % d, % d, &data. year, &data. month, &data. day) ; daysum = days( data. year, data. month, data. day) ; printf( \ nthe dayth is % d \n, daysum) ; days( int year, int month, int day) / * * / { nt daysum, i; int tt[ 13 ] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ;
C daysum = 0; for( i = 1; i < month; i + + ) daysum = daysum + tt[ i] ; if( onth >= 3&&( year% 4 = = 0&&year% 100! = 0 year% 4 == 0) ) daysum + = 1; return( daysum) ; 2. : a b,, a b,, #include stdio. h struct ; tudent{ char num[ 10 ] ; float cj; struct student * next; { truct student a[ 4] = { { 001, 90, { 002, 85, 003, 91, { 004, 76 ; struct student b[ 5] = { { 005, 85, 006, 68, { 003, 91, int i, j; { 008, 64, { 007, 78 ; struct student * p, * p1, * p2, * pt, * head1, * head2 ; head1 = a; /* * / head2 = b; printf( list a: \ n ) ; for p1 = head1, i = 1; p1 < a + 4; i + + ) { = p1; p1 - > next = a + i; printf( % 8 s% 8. 1 f\ n, p1 - > num, p1 - > cj) ; p1 = p1 - > next; 47
p - > next = 0; printf( list b: \ n ) ; for p2 = head2, i = 1; p2 < b + 5; i + + ) { = p2; p2 - > next = b + i; printf( % 8 s% 8. 1 f\ n, p2 - > num, p2 - > cj) ; p2 = p2 - > next; printf( \ n ) ; p1 = head1; /* * / while( p1! = 0) { 2 = head2; while( p2! = 0&&strcmp( p1 - > num, p2 - > num)! = 0) p2 = p2 - > next; if strcmp( p1 - > num, p2 - > num) = = 0) if( p1 = = head1) head1 = p1 - > next; else p - > next = p1 - > next; p = p1 ; p1 = p1 - > next; p1 = head1; /* * / printf( \ n result: \ n ) ; while( { printf( % 8s% 8. 1f\ n, p1 - > num, p1 - > cj) ; 1 = p1 - > next;
C 21 1. 2. union study { nt i[ 2] ; x; float a; long b; char c; { canf( % d, % d, &x. i[ 0 ], &x. i[ 1 ] ) ; printf( i[ 0] = % d, i[ 1] = % d, a = % f, b = % ld, c = % c \ n, x. i[ 0], x. i[ 1], x. a, x. b, x. c) ; 1000, 2000, : scanf( % ld, &x. b) ; printf, 60000,?? 22 1. 2. 49
( : 16, 0) { nsigned int a, b; int n1, n2; printf( input a octal number: ) ; scanf( % o, &a) ; printf( input n1, n2 ) ; scanf( % d, % d, &n1, &n2) ; b = 0; b = ( b > > n1) &( b < < ( 16 - n2 ) ) ; b = a&b; b = b > > ( 16 - n2) ; printf( result: % o \n, b) ; 177776 < > 5, 10 < >, 000011 < > 5, 10 < >, 23 1. 2. 1. : #include stdio. h
{ ILE * p; char ch, filename[ 10] ; scanf( % s, filename) ; if ( p = fopen( filename, w ) ) = = NULL) { rintf( cannot open file \n ) ; exit( - 1 ) ; while( ( ch = getchar( ) )! = \ n ) fputc( ch, p) ; fclose( p) ; ( 1 ) head1. c < > ) welcome to c < > C ( ), ( 2 ) wr, while : while( ( ch = fgetc( p) )! = EOF) putchar( ch) ; head1. c < >, 2., 51
C 1 1. C ( ) ( ) ( ) 2. C ( ) ( ) ( ) 3. C ( ) 4. C ( ) 5. C ( ) 6. int a; a ( ) float x; x ( ) char u; u ( ) 7. C int ( ), float ( ), char ( ) 8. int x = 6;, x% 2 + ( x + 1) % 2 ( ) 9. int x;, x = 25 /3% 3 ( ) 10. int a = 6;, a + = a - = a* a ( ) 11. int a;, ( a = 4* 5, a* 2), a + 6 ( ) 12. int x, a;, ( 1) x ( ), ( 2 ) x ( ) ( 1 ) x = ( a = 4, 6* 2) ( 2) x = a = 4, 6* 2 13. char ch;, ch = a + 8-3 ( 14. C ( ) 15. C ( ) 16. C ( ) 17. C, LEI lei ( ) ) 18. int float char ( ) ( )
( ) ( ) ( C 19. int x;, scanf( % f, x) ; x, ( ) ( ) 20. int a, b scanf( ) ( ) 21. int a, b, 5, printf( ) ) 22. float x, y, 6, 2, printf( ) ( ) 1. C ( ) A) ) C) D) 2. ( ) A) A P 0 do B) float 1a0 A C) b - a goto int 3. ( ) A) 160-0xffff 011 B) - 0xcdf 01a 0xe C) - 01 968 0668 4. ( ) D) 123 temp INT D) - 0x48a 2e5 A) + 1e + 1 B) -. 60 C) 123e D) - e3 5e - 9. 4 12e - 4 1. 2e -. 4. 8e - 4 03 e2-8e5 + 2e - 1 5. e - 0 5. ( ) A) \ \ \ \ n B) \ \017 \ 6. ( ) C) \018 \ f \ xab 0x D) \ \0 A) lei B) y + x C) minx. D) aax* 7. ( ) \101 \ x1f A) aaa B) ax1 C) 9 xx D) max 2 8. ( ) A) short a = 1 -. le - 1; B) double b = 1 + 5e2. 5; 53
C) long do = 0xfdaL; D) float 2 and = 1 - e - 3; 9. C, ( ) A) B), C) D) 10. ( ) A) x B) W C) D) XYZ 11. ( ) A) x B) ABC C) ABC D) 1 12. C, ( ) A) + + B) / C) % D) * 13. int a = 5, y; y = a + + ;, a, y ( ) A) a = 6, y = 5 B) a = 6, y = 6 C) a = 6, y = 7 D) a = 5, y = 6 14. C ( ) A) ( ) B) [ ] C) { D) 15. 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) 16. int a = 7; float x = 2. 5, y = 4. 7 ;, x + a% 3 * ( int) ( x + y) % 2 /4 ( ) A) 2. 500000 B) 2. 750000 C) 3. 500000 D) 0. 000000 17. : char w; int x; float y; double z;, w* x + z - y ( ) A) float B) char C) int D) double 18. int, 7 ( ) A) ( x = y = 6, x + y, x + 1 ) B) ( x = y = 6, x + y, y + 1 ) C) ( x = 6, x + 1, y = 6, x + y) D) ( y = 6, y + 1, x = y, x + 1) 19. 3ae, C ( ) bc A) a / b / c* e* 3 B) 3 * a* e / b /c C) 3* a* e /b* c D) a* e /c / b* 3 20. scanf( ) ( ) A) % f B) % u C) % o D) % c 21. int a, b = 5;, a ( )
A) 10 + 2 = a; B) scanf( % d, &a) ; C) a = ( b + 6 ) /3; D) a = c ; 22. int a; &a ( ) A) B) a C) a D) 1. int a; a = 90000; 2. char c; c = y ; 3. int a, b; scanf( % D, % D, &a, &b) ; 4. int a = 10 ; float x = 1. 25; printf( % f, % d, a, x) ; 5. int i = j = k = 0; 1. ain( ) { nt x = 1, y = 1; 2. ain( ) x = x + y; y = x + y; printf ( x = % d y = % d \ n, x, y) ; { nt x = 7, a = 2, b = 2, c; c = x /a% b; printf( c = % d \n, c) ; 1., C 55
2., C = 5 9 ( F - 32) * / 3. a b, av, s1 s2 #include math. h / * sqrt( ), math. h 4., v 0 q g = 9. 8 s( s = 2v 2 0 sinqcosq / g) 2 1. A ASCII 65, ( ) { har ch1, ch2 ; ch1 = A + 5-3 ; ch2 = A + 6-3 ; printf( % d, % c \ n, ch1, ch2) ; A) 67, D B) 3, C C) C, D D)
C 2. ( ) { nt x = f ; printf( % c \n, A + ( x - a + 1) ) ; A) G B) H C) I D) J 3. ( ) # include < stdio. h > { nt a, b, d = 241; a = d /100% 9; b = ( - 1) * ( - 1) ; printf( % d, % d \ n, a, b) ; A) 6, 1 B) 2, 1 C) 6, 0 D) 2, 0 4. ( ) { ouble d = 3. 2 ; int x, y; x = 1. 2; y = ( x + 3. 8) /5. 0; printf( % d \n, d* y) ; A) 3 B) 3. 2 C) 0 D) 3. 07 5. sizeof( double) ( ) A) B) C) D) 6. printf( a \bre \ hi \ y \ \ \ bou \ n ) ; ( ) A) a \ bre \ hi \ y \ \ \bou C) re hi you B) a \ bre \ hi \ y\ bou D) abre hi y \ bou 7., ( ) A) + + t; B) n1 = ( n2 = ( n3 = 0) ) ; C) k = i = = j; D) b + c = 1; 8. : int i = 65536; printf( % d \n, i) ; 57
( ) ( ) A) 65536 B) 0 C), D) - 1 9. ( ) { nt x = 10, y = 3; printf( % d \n, y = x/ y) ; A) 0 B) 1 C) 3 D) 10. ( ) { nt a = 12, b = 12; printf( % d, % d \ n, a - -, b + + ) ; A) 11, 12 B) 12, 11 C) 12, 12 D) 11, 11 11. ( ) { nt a = 12, b = 12; printf( % d % d \n, - - a, + + b) ; A) 10 10 B) 12 12 C) 11 10 D) 11 13 12. int x = 11;, ( x + +* 1 /3) ( ) A) 3 B) 4 C) 11 D) 12 13. x int, x = 10 ; x + = x - = x - x;, x A) 10 B) 20 C) 40 D) 30 14. x, y, z k int, x = ( y = 4, z = 16, k = 32), x ( ) A) 4 B) 16 C) 32 D) 52 15. x y int, x = 100, y = 200, : printf( % d, ( x, y) ) ; ( ) A) 200 B) 100 C) 100 200 D),
C 16. x y int, x + = y; y = x - y; x - = y; ( ) A) x y B) x y C) D) x y 3 1. ( ) { ouble d; float f; long l; int i; i = f = l = d = 20 /3; printf( % d % ld %. 1f %. 1 f\n, i, l, f, d) ; A) 6 6 6. 0 6. 0 B) 6 6 6. 7 6. 7 C) 6 6 6. 0 6. 7 D) 6 6 6. 7 6. 0 2. : 123 < > 456 < > 789 < >, ( ) { har s[ 100] ; int c, i; scanf( % c, &c) ; scanf( % d, &i) ; scanf( % s, s) ; printf( % c, % d, % s \ n, c, i, s) ; A) 123, 456, 789 B) 1, 456, 789 C) 1, 23, 456, 789 D) 1, 23, 456 3. ( ) { nt k = 17; printf( % d, % o, % x \n, k, k, k) ; A) 17, 021, 0 x11 B) 17, 17, 17 C) 17, 0x11, 021 D) 17, 21, 11 59
4. ( ) { int k = 11; printf( k = % d, k = % o, k = % x \ n, k, k, k) ; A) k = 11, k = 12, k = 11 B) k = 11, k = 13, k = 13 C) k = 11, k = 013, k = 0xb D) k = 11, k = 13, k = b 5., 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) 0 20 < > AB < > ) ( ) C) 10 20 AB < > D) 10 20 AB < > 6., ( ) : float f1, f2; :. 52 3. 5 A) scanf( % f, % f, &f1, &f2) ; B) scanf( % f% f, &f1, &f2 ) ; C) scanf( % 3. 2f % 2. 1 f, &f1, &f2) ; D) scanf( % 3. 2f% 2. 1f, &f1, &f2) ; 7., : 25, 13, 10 < >, ( ) { nt x, y, z; scanf( % d% d% d, &x, &y, &z) ; printf( x + y + z = % d \ n, x + y + z) ; A) x + y + z = 48 B) x + y + z = 35 C) x + z = 35 D) 8., ( )
C { nt x; float y; printf( enter x, y: ) ; enter x, y: 2 3. 4 x + y = 5. 40 A) canf( % d, % f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; B) canf( % d% f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; C) canf( % d% f, &x, &y) ; printf( \ nx + y = % 6. 1f, x + y) ; D) canf( % d% 3. 1 f, &x, &y) ; printf( \ nx + y = % 4. 2f, x + y) ; 4 ( 1. C, ( ), ( ) 2. C ( ), ( ) 3. ( ) 4. ( ) 5. ( ) 6. ) 7. a, b, : ( 1 ) a&&b ( ) ( 2 )! ( a b) &&a ( ) ( 3 )! a b ( ) ( 4 ) ( a&&! b) ( b&&! a) ( ) 8. int a, b, c;, a b c ( ) 9. int a, b, c;, a, b, c 0 ( ) 10. 0 < = x < = 100 x < - 100 ( ) 61
11. a, b, c, ( ), ( ) 12. int x = 5, y = 6, z = 1;, : ( 1 ) x + y && z ( ) ( 2 ) x + y > 8 && x - y > 1 ( ) ( 3 ) x + y > 8 x - y > 1 ( ) ( 4 ) z = = y > 0 ( ) ( 5 )! x < z ( ) 13. 5 > 3 && 2 8 < 4 -! 1 ( ) 14. int a = 1, b = 2;, ( a < b? a: b) ( ) 15. switch break ( ) 1. C, > = ( ) A) B) C) D) 2., ( ) A)! B) && C) + D) 3., ( ) A)! B) && C) + D) 4. int a = 2, b = 5;, a + 5 > b + 3 ( ) A) 0 B) 1 C) D) 5. : int a = 1, b = 2, c = 3, d = 4, m = 2, n = 2; : ( m = a > b) &&( n = c > d), n ( ) A) 1 B) 2 C) 3 D) 0 6. x, y, z, t int, x = y = z = 1; t = + + x + + y&& + + z;, t ( ) A) B) 2 C) 1 D) 0 7. a 0 ( ) A) a < > 0 B)! a C) a = 0 D) a! = 0 8. a10 a0 ( ) A) a > = 10 or a < = 0 B) a > = 10a < = 0 C) a > = 10a < = 0 D) a > = 10 &&a < = 0 9. int x = 1, y = 1;, (! x y - - ) ( )
C A) 0 B) 1 C) 2 D) - 1 10. a b ( ) A) ( a > = 0 b > = 0 ) &&( a < 0b < 0) B) ( a > = 0&&b > = 0) &&( a < 0&&b < 0) C) ( a + b > 0 ) &&( a + b < = 0) D) a* b > 0 11. ( ) { nt x = 100, a = 10, b = 20, ok1 = 5, ok2 = 0 ; if( a < b) if b! = 15) if(! ok1) x = 1; el e if( ok2 ) x = 10; else x = - 1; printf( % d \ n, x) ; A) - 1 B) 0 C) 1 D) 12. a = 1, b = 3, c = 5, d = 4,, x ( ) if( a < b) if( c < d) x = 1; else f a < c) else x = 7; if( b < d) x = 2; else x = 3; else x = 6; A) 1 B) 2 C) 3 D) 6 13. y = ( x > 0? 1: x < 0? - 1: 0 ) ; if ( ) A) f ( x > 0) y = 1; else f( x < 0) y = - 1; B) ( x) else y = 0; if( x > 0) y = 1; else f( x < 0) y = - 1; 63
C) = - 1 if x) D) = 0 ; else y = 0 ; if( x > 0 ) y = 1; else if( x = = 0 ) y = 0; else y = - 1; i ( x > = 0) i ( x > 0) y = 1; else y = - 1 ; 14. a = 1, b = 2, c = 3, d =4, a < b? a: c < d? a: d ( ) A) 4 B) 3 C) 2 D) 1 15. char ch = A, ( ) ch = ( ch > = A &&ch < = Z )? ( ch + 32) : ch A) A B) a C) Z D) z 16. ( ) { nt x = 12, y; y = x > 12? x + 10: x - 12; printf( y = % d \ n, y) ; A) y = 0 B) y = 22 C) y = 12 D) y = 10 17. switch, case ( ) A) B) C) D) 18. k 3, ( ) switch( k) { ase 1: putchar( A ) ; case 2: putchar( B ) ; case 3: putchar( C ) ; case 4: putchar( D ) ; default: putchar( E ) ; A) CDE B) C C) ABC D) ABCD
C 1. : a > b, c = 0; c = 1 int a = 1, b = 2, c; if( a > b) ; c = 0; else c = 1 ; 2. : a > b, a, b int a, b, c; scanf( % d, % d, &a, &b) ; if( a > b) c = a; a = b; b = c; 1. ain( ) { nt a = 1, b = 2, c = 3 ; if( a > c) 2. ain( ) b = a; a = c; c = b; printf( a = % d b = % d c = % d \ n, a, b, c) ; { nt a = 3, b = 2, c = 1 ; 3. ain( ) if( a > b) a = b; if( b > c) b = c; else c = b; c = a; printf( a = % d b = % d c = % d \ n, a, b, c) ; { nt x = 2, y = 3, z; z = x; if( x > y) z = 1 ; else if( x = = y) z = 0 ; else z = - 1; printf( z = % d \n, z) ; 65
4. ain( ) { nt a = 10, b = 5, x; x = a < b? b: a; printf( x = % d \n, x) ; 1. 2. 85, 10 5%, 100 10%, 2., 3., 80 100 very good!, 60 79 good!, 40 59 fair, 0 39 poor
C 4. switch,, 90 A, 80 89 B, 70 79 C, 60 69 D, 60 E 5 ( 1. while( ), ( ), ) 2. while, while ( ) 3. for( 1; 2; 3 ), ( ) 0 4. continue ( ) 5. break ( ) 6., 0 { nt a, max = 0; scanf( % d, &a) ; wh le( { f( max < a) max = a; scanf( % d, &a) ; printf( % d, max) ; 7., 67
#include stdio. h { har c; int n = 0 ; c = getchar( ) ; while( { f( n + + ; c = getchar( ) ; 8. or( a = 0, b = 0; b! = 100&&a < 5; a + + ) scanf( % d, &b) ; scanf ( ), ( ) 9. 30, 90, for x = 1 ; x < = 29; x + + ) { y = 30 - x; if( printf( % d, % d, x, y) ; 10. 1-3 + 5-7 + - 99 + 101 { nt i, t = 1, s = 0; fo ( i = 1; i < = 101; i + = 2) { s = s + t* i; printf( % d, s) ; 11. 10, 7, { nt i, a; for i = 1; i < = 10 ; i + + ) { s anf( % d, &a) ; if( a% 7 = = 0) { printf( % d, a) ;
C 1. ( ) A) B) C) D) 2. : int i; for( i = 0; i < = 10 ; i + + ) ;, i = 0, ( ) A) for B) C) for D) 3. ( ) A) do... while B) do... while break C) do... while, while D) do... while, while 4., ( ) { nt n = 0 ; while( n < = 2) { + + ; printf( % 3d, n) ; A) 1 B) 1 2 C) 1 2 3 D) 1 2 3 4 5. ( ) int a, y; a = 10; y = 0 ; do { + = 2; y + = a; printf( a = % d y = % d \ n, a, y) ; if( y > 20) break; while( a = 14) ; A) a = 12 y = 12 a = 14 y = 16 a = 16 y = 20 a = 18 y = 24 B) a = 12 y = 12 a = 16 y = 28 C) a = 12 y = 12 D) a = 12 y = 12 a = 14 y = 26 a = 14 y = 44 69
6. ( ) for( i = 1; i < = 3; i + + ) ; printf( ok ) ; A) ok B) okok C) okokok D) 7. ( ) int s = 7; while( - - s) ; s = s - 2; printf( s = % d \n, s) ; A) s = 1 B) s = 2 C) s = 0 D) s = - 2 8. ( ) a = - 1; do { a = a* a; while(! a) ; A) 1 B) 2 C) D) 9., 1, - 3, 5, 8, - 2, ( ) { nt i, x; for( i = 1; i < = 5 ; i + + ) { canf( % d, &x) ; if( x < = 0 ) continue; printf( % d, x) ; A) - 3-2 0 B) 1 5 8 C) 1-3 5 8-2 D) - 3-2 10. s = 12345 ( ) A) for( i = 1; i < = 5; i + + ) { s = 1 ; C) s = 1; s = s* i; for( i = 1; i < = 5; i + + ) s = s* i; 11. ( ) B) for( i = 1; i < = 5; i + + ) { s = 0; D) s = 0; s = s* i; for( i = 1; i < = 5; i + + ) s = s* i;
C ( ) for( i = 1; i < = 100; i + + ) { canf( % d, &x) ; if( x < 0) continue; printf( % d, x) ; A) x < 0 B) x0 C) printf( ) D) 100 12. ( ) { nt k = 10; while( k = 0) { = k - 1; printf( k = % d, k) ; A) 10 B) while C) D) 1 13. ( ) { nt k = 2; wh le( k! = 0) { rintf( k = % d, k) ; k - - ; A) B) 0 C) 2 D) 1 14., 65 14 < >, main ( ) { nt m, n; printf( Enter m, n: ) ; scanf( % d% d, &m, &n) ; while( m! = n) { hile( m > n) m - = n; while( n > m) n - = m; printf( m = % d \ n, m) ; 71
A) m = 3 B) m = 2 C) m = 1 D) m = 0 15., ( ) A) int i = 100 while ( 1) {i = i%100 + 1; if( i > 100) break; B) for( ; ; ) ; C) int k =1000; do{ + + k while ( k > =1000) ; 16. for( i = 1; i + + < 4; ) ;, i ( ) D) int s =36 A) 3 B) 4 C) 5 D) 17. a b int, b ( ) a = 1; b = 10; do {b - = a; a + + ; while( b < 0) ; A) 9 B) - 2 C) - 1 D) 8 while( s) ; - - s; 18., 3, 0, ( 1),( 2) { ong int num; scanf( % ld, &num) ; do if( ( 1) ) printf( % ld, num) ; scanf( % ld, &num) ; while( ( 2 ) ) ; ( 1 ) ) num% 100 /10 = = 3 B) num /100 % 10 = = 3 C) num% 10 /10 = = 3 D) num/10% 10 = = 3 ( 2 ) A)! num B) num > 0 = = 0 C)! num = = 0 D)! num! = 0 1. s = 1 + 2 + 3 + 4 + 5 s = 0 ; for( i = 1, i < = 5, i + + ) ; s = s + i;
C 2. s = 12345 s = 0 ; for( i = 1; i < = 5; i + + ) s = s* i; 1. ain( ) { nt x = 1, y = 1, i = 0; do 2. ain( ) { = x + y; y = x + y; i + + ; printf ( x = % d while( i < = 3) ; { nt x = 2, y = 10, i; 3. ain( ) for( i = x; i < = y; i + + ) ; printf( i = % d \ n, i) ; { nt x, y; 4. ain( ) y = % d \ n, x, y) ; fo ( y = 1, x = 1; y < = 50; y + + ) { f( x > = 10) break; if( x% 2 = = 1) { x + = 5; continue; x - = 3; printf( x = % d, y = % d \n, x, y) ; { nt j; fo ( j = 10; j > 3 ; j - - ) { f( j% 3) j - - ; 5. ain( ) j - = 2; printf( % 3d, j) ; 73
{ nt x = 1, y = 0; switch( x) { ase : switch( y) 6. ain( ) { ase 0: printf( * * 1* * \ n ) ; break; case 1: printf( * * 2* * \ n ) ; break; case 2: printf( * * 3* * \n ) ; { nt x = 0, y = 0; 7. ain( ) while( x < 15) y + +, x + = + + y; printf( % d, % d, y, x) ; { nt i, sum = 0; 8. ain( ) for( i = 0 ; i < 3; i + + ) printf( % d % d \ n, i, sum + = i) ; { i t i; 9. ain( ) fo ( i = 1; i < = 5; i + + ) { f( i% 2 ) printf( * ) ; else continue; printf( # ) ; printf( \ n ) ; { i t i; fo ( i = 1; i < = 5; i + + ) sw tch( i% 2 ) { ase 0: i + + ; printf( # ) ; break; case 1: i + = 2 ; printf( * ) ; default: printf( \ n ) ;
C 1. n, 2. x, 0,, 3., : 50, 1. 5 ; 50, 0. 6, 5 150, 5 1 4. 30 5, 75
6 1. int a[ 10] ;, a ( ), ( ) 2. int x[ 10] ;, x ( ), ( ), ( ), x ( ) 3. str Lei( ) 4. int a[ ] = {0, 1, 2, 3, 4, 5 ;, ( ) 5.,? ( ) 1. int a[ 10 ] ;, ( ) A) a( 9 ) B) a[ 9 ] C) a[ 10] D) a[ 3. 5] 2. ( ) A) int x[ 5] = {0, 1, 2, 3, 4, 5 ; B) int x[ ] = {0, 1, 2, 3, 4, 5 ; C) int x[ 5 ] = {0. 0 ; D) int x[ ] = ( 0, 1, 2, 3, 4, 5) ; 3. ( ) A) int x( 10) ; B) int x[ 5] = {0, 1, 2, 3, 4, 5 ; C) int n = 10; x[ n] ; D) int x[ ] = {0, 1, 2, 3, 4, 5 ; 4. a ( ) A) int a( 10) B) int n = 10, a[ n] ; C) int n; D) #define SIZE 10 scanf( % d, &n) ; int a[ SIZE] ; int a[ n] ; 5. ( ) A) int a[ 3] [ ] ; B) float a( 3, 4) ; C) double a[ 1] [ 4 ] ; D) float a( 3) ( 4) ; 6. : int a[ 3] [ 4] ;, ( ) A) a[ 2 ] [ 4 ] B) a[ 1, 3] C) a[ 1 + 1] [ 0] D) a( 2) ( 1) 7. ( ) A) int a[ 2] [ ] = { {1, 0, 1, {5, 2, 3 ;
C ( ) B) int a[ ] [ 3] = { {1, 2, 3, {4, 5, 6 ; C) int a[ 2 ] [ 4] = { {1, 2, 3, {4, 5, { 6 ; D) int a[ ] [ 3] = { {1, 0, 1 {, {1, 1 ; 8. ( ) A) ain( ) B) { loat a[ 10] = {0. 0 ; C) int i; D) for( i = 0; i < 3; i + + ) scanf( % d, &a[ i] ) ; E) for( i = 1; i < 10; i + + ) a[ 0] = a[ 0 ] + a[ i] ; F) printf( % f\ n, a[ 0 ] ) ; 9. str1, str2 ( ) A) if( str1 = = str2) ) if( if( str1 = str2 ) ) C) if( strcpy( str1, str2) ) D) if( strcmp( str1, str2 ) ) 10. : char array [ ] = China ;, array A) 4 ) 5 ) 6 ) 7 11. ( ) { nt a[ 6], i; f r( i = 1; i < 6; i + + ) { [ i] = 9* ( i - 2 + 4* ( i > 3) ) % 5; printf( % 2d, a[ i] ) ; A) - 4 0 4 0 4 B) - 4 0 4 0 3 C) - 4 0 4 4 3 D) - 4 0 4 4 0 12. s, ( ) A) char s[ 5] = { abc ; B) char s[ 5] = { a, b, c ; C) char s[ 5 ] = ; D) char s[ 5] = abcdef ; 13. ( ) char c[ 5] = { a, b, \0, c, \0 ; printf( % s, c) ; A) a b B) ab C) ab c D) abc 14. : char a[ ] = ABCDEF ; 77
char b[ ] = { ( ) A, B, C, D, E, F ; A) a b B) a b C) a b D) a b 15. : int i; int x[ 3 ] [ 3] = {1, 2, 3, 4, 5, 6, 7, 8, 9 ; ( ) for( i = 0; i < 3 ; i + + ) printf( % 2d, x[ i] [ 2 - i] ) ; A) 1 5 9 B) 1 4 7 C) 3 5 7 D) 3 6 9 16., k ( ) int k = 3, s[ 2] ; s[ 0] = k; k = s[ 1] * 10 ; A) B) 33 C) 30 D) 10 17., Hello! b ( ) A) char b[ 10] = { H, e, l, l, o,! ; B) char b[ 10] ; b = Hello! ; C) char b[ 10] ; strcpy( b, Hello! ) ; D) char b[ 10] = Hello! ; 18. ( ) char a[ 7] = abcdef ; char b[ 4] = ABC ; strcpy( a, b) ; printf( % c, a[ 5] ) ; A) ( ) B) \0 C) e D) f 19. s1 s2, ( ) A) if( s1 > s2) B) if( strcmp( s1 > s2) ) C) if( strcmp( s2, s1) > 0 ) D) if( strcmp( s1, s2 ) > 0) 20. ( ) A) B) C) = D) 21. ( ) { char ch[ 7 ] = { 12ab56 ; int i, s = 0;
for( = 0; ch[ i] > = 0 &&ch[ i] < = 9 ; i + = 2) s = 10* s + ch[ i] - 0 ; printf( % d \ n, s) ; C A) 1 B) 1256 C) 12ab56 D) 12 56 1., int n; int a[ n] ; 2. a : { nt a[ 10], i; for( i = 1 ; i < 10; i + + ) scanf( % d, &a[ i] ) ; 1. ain( ) { nt a[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, s = 0, i; 2. ain( ) for( i = 0 ; i < 10; i + + ) if( a[ i] % 2 = = 0) s = s + a[ i] ; printf( s = % d, s) ; { nt a[ ] = {1, 3, 5, 2, 7 ; 3. ain( ) int b[ ] = { 5, 3, 9, 4, 6 ; int c[ 5], i; f r( i = 0; i < 5; i + + ) c[ i] = a[ i] * b[ i] ; for( i = 0 ; i < 5; i + + ) printf( % d, c[ i] ) ; { nt i, k, a[ 10 ], p[ 3] : k = 5; for ( i = 0 ; i < 10; i + + ) a[ i] = i; 79
4. ain( ) { for ( i = 0 ; i < 3; i + + ) p[ i] = a[ i* ( i + 1) ] ; for ( i = 0 ; i < 3; i + + ) k = p[ i] * 2; printf( % d \n, k) ; int y = 18, i = 0, j, a[ 8 ] ; do { a[ i] = y% 2; i + + ; y = y /2; while( y > = 1) ; for( j = i - 1; j > = 0; j - - ) printf( % d, a[ j] ) ; printf( \ n ) 1. 100, 2. n,,,,
C 3. n, m,,,, 7 1. ( ) ( ), ( ) ( ) 2., ( ) 3., ( ) 1. ( ) A) B) C) D), 2. ( ) A), B) return C), D), 3. ( ) A) B) C) D) 81
4., ( ) A) B) C) D) 5. ( ) A) double fun( int x, int y) B) double fun( int x; int y) C) double fun( int x, int y) ; D) double fun( int x, y) ; 6. ( ) A) ouble fun( int x, int y) { z = x + y; return z; C) un( x, y) { nt x, y; double z; z = x + y; return z; 7. ( ) B) un( int x, y) { nt z; return z; D) ouble fun( int x, int y) { ouble z; A) C z = x + y; return z; B) C, C) C D) C 8. ( ) A) B) C) D) 9. : fun( a + b, ( x, y), fun( n + k, d, ( a, b) ) ) ;, ( ) A) 3 B) 4 C) 5 D) 6 10. ( ) #include stdio. h func( int a, int b) { nt c; c = a + b; return c;
C { nt x = 6, y = 7, z = 8, r; r = func( x - -, y + +, x + y), z) ; printf( % d \ n, r) ; A) 11 B) 20 C) 21 D) 31 11. ( ) fun3( int x) { tatic int a = 3 ; a + = x; return( a) ; { nt k = 2, m = 1, n; n = fun3( k) ; n = fun3( m) ; printf( % d \ n, n) ; A) 3 B) 4 C) 6 D) 9 12. static char str[ ] = Beijing ;, printf( % d \ n, strlen ( strcpy( str, China ) ) ) ; ( ) A) 5 B) 7 C) 12 D) 14 13., fun ( ) { in a[ 50], n; fun(, &a[ 9] ) ; A) void fun( int m, int x[ ] ) B) void fun( int s, int h[ 41 ] ) C) void fun( int p, int * s) D) void fun( int n, int a) 14. ( ) void func1( int i) ; void func2( int i) ; char st[ ] = hello, friend! ; 83
void func1( int i) { p intf( % c, st[ i] ) ; if( i < 3) { i + = 2; func2 ( i) ; void func2( int i) { rintf( % c, st[ i] ) ; if( i < 3 ) { i + = 2; func1( i) ; { nt i = 0; func1( i) ; printf( \ n ) ; A) hello B) hel C) hlo D) hlm 1. oid num( ) { xtern int x, y; int a = 15, b = 10 ; x = a - b; y = a + b; int x, y; { nt a = 7, b = 5; x = a + b; y = a - b; num( ) ; printf( % d, % d \ n, x, y) ; 2. unc( int a, int b) { tatic int m = 0, i = 2; i + = m + 1; m = i + a + b; return m;
C { nt k = 4, m = 1, p; p = func( k, m) ; printf( % d,, p) ; p = func( k. m) ; printf( % d \ n, p) ; 8 1. : #define N 3 #define Y( n) ( ( N + 1) * n) : z = 2* ( N + Y( 5 + 1 ) ) ;, z ( ) A) B) 42 C) 48 D) 54 2. ( ) #include stdio. h #define SUB( X, Y) ( X) * Y { nt a = 3, b = 4; printf( % d, SUB( a + +, b + + ) ) ; A) 12 B) 15 C) 16 D) 20 3. ( ) #include stdio. h #define MIN( x, y) ( x) < ( y)? ( x) : ( y) { nt i, j, k; i = 10; j = 15; k = 10 * MIN( i, j) ; printf( % d \n, k) ; A) 15 B) 100 C) 10 D) 150 4., a ( ) #define SQR( X) X* X { nt a = 10, k = 2, m = 1; 85
a / = SQR( k + m) / SQR( k + m) ; printf( % d \n, a) ; A) 10 B) 1 C) 9 D) 0 5. ( ) #define MA( x) x* ( x - 1) { nt a = 1, b = 2; printf( % d \n, MA( 1 + a + b) ) ; A) 6 B) 8 C) 10 D) 12 9 1. ( ) int fun( int x, int y, int * cp, int * dp) { cp = x + y; * dp = x - y; { nt a, b, c, d; a = 30; b = 50; fun( a, b, &c, &d) ; printf( % d, % d \ n, c, d) ; A) 50, 30 B) 30, 50 C) 80, - 20 D) 80, 20 2. : int f( char * s) { har * p = s; while( * p! = \0 ) p + + ; return( p - s) ;, ( ) printf( % d \ n, f( goodbey! ) ) ;
C A) 3 B) 6 C) 8 D) 0 3. ( ) void prtv( int * x) { printf( % d \n, + + * x) ; { nt a = 25 ; prtv( &a) ; A) 23 B) 24 C) 25 D) 26 4. ( ) int funl( char * x) { har * y = x; while( * y + + ) ; return( y - x - 1 ) ; A) B) C) x y D) x y 5. ( ) sss( s, t) char * s, * t; { hile( ( * s) &&( * t) &&( * t + + = = * s + + ) ) ; return( * ( - - s) - * ( - - t) ) ; A) B) C) s t D) s t 6. ( ) { nt i, x[ 3] [ 3] = {9, 8, 7, 6, 5, 4, 3, 2, 1, * p = &x[ 1] [ 1] ; for( i = 0 ; i < 4; i + = 2) printf( % 3d, * ( p + i) ) ; A) 5 2 B) 5 1 C) 5 3 D) 9 7 7. : long int * p, a;, scanf ( ) 87
A) p = &a; scanf( % ld, p) ; B) = &a; scanf( % ld, p) ; C) scanf( % ld, p = &a) ; D) scanf( % ld, &a) ; 8. : char * st = how are you ;, ( ) A) har a[ 11 ], * p; strcpy( p = a + 1, &st[ 4] ) ; C) har a[ 11] ; strcpy( a, st) ; 9., ( ) { har * s = abcde ; s + = 2; printf( % ld \n, s) ; B) har a[ 11] ; strcpy( + + a, st) ; D) har a[ ], * p; strcpy( p = &a[ 1 ], st + 2) ; A) cde ) c ASCII ) c ) 10. : char str[ ] = ABCD, * p = str; printf( % d \ n, * ( p + 4) ) ; ( ) A) 68 B) 0 C) D D) 11. p1 p2 int, k int, ( ) A) k = * p1 + * p2; B) p2 = * k; C) p1 = p2; D) k = * p1 * ( * p2 ) ; 12. : int i, j = 7, * p = &i;, i = j; ( ) A) i = * p; ) * p = * &j; ) i = &j; ) i = * * p; 13. ( ) #include stdio. h #include string. h { har * p1 = abc, * p2 = ABC, str[ 50] = xyz ; strcpy( str + 2, strcat( p1, p2) ) ; printf( % s \ n, str) ;
C A) xyzabcabc B) zabcabc C) yzabcabc D) xyabcabc 14. ( ) { har a[ ] = programming, b[ ] = language ; char * p1, * p2; int i; p1 = a; p2 = b; fo ( i = 0; i < 7 ; i + + ) if * ( p1 + i) = = * ( p2 + i) ) printf( % c, * ( p1 + i) ) ; A) gm B) rg C ) or D) ga 15. x, pb, ( ) A) pb = &x B) pb = x; C) * pb = &x; D) * pb = * x 16. s ( ) char * s = \ \ Name \ \ Address \ n ; A) 19 B) 15 C) 18 D) 17. : int arr[ ] = {6, 7, 8, 9, 10 ; int * ptr; ( ) ptr = arr; * ( ptr + 2) + = 2; printf ( % d, % d \n, * ptr, * ( ptr + 2) ) ; A) 8, 10 B) 6, 8 C) 7, 9 D) 6, 10 18. int( * ptr) [ m] ;, ptr ( ) A) m B) m C) m D) m, 19., ( ) A) char st[ 4] [ 5] = { ABCDE ; B) char s[ 5 ] = { A, B, C, D, E ; 89
C) char * s; s = ABCDE ; D) char * s; scanf( % s, s) ; 20. ( ) void func( int * a, int b[ ] ) { b[ 0] = * a + 6 ; { t a, b[ 5] ; a = 0; b[ 0] = 3; func( &a, b) ; printf( % d \ n, b[ 0] ) ; A) 6 B) 7 C) 8 D) 9 21. ( ) int b = 2 ; int func( int * a) { + = * a; return( b) ; { nt a = 2, res = 2; res + = func( &a) ; printf( % d \ n, res) ; A) 4 B) 6 C) 8 D) 10 22. ( ) { nt a[ 3] [ 3 ], * p, i; p = &a[ 0] [ 0] ; for( i = 0; i < 9; i + + ) p[ i] = i + 1; printf( % d \ n, a[ 1] [ 2] ) ; A) 3 B) 6 C) 9 D) 23. ( ) A) int * p; B) int * s, k; scanf( % f, p) ; * s = 100;
C C) int * s, k; D) int * s, k; char * p, c; char * p, c; s = &k; p = &c; s = &k; p = &c; * p = a ; s = p; * s = 500; 24. ( ) { har arr[ 2] [ 4] ; strcpy( arr, you ) ; strcpy( arr[ 1 ], me ) ; arr[ 0] [ 3] = & ; printf( % s \ n, arr) ; A) you&me B) you C) me D) arr 10 1. ( ) #include stdio. h { nion { nt k; char i[ 2] ; * s, a; s = &a; s - > i[ 0] = 0x39 ; s - > i[ 1] = 0x38; printf( % x \n, s - > k) ; A) 3839 B) 3938 C) 380039 D) 390038 2. : typedef nion 91
struct { ong i; ate int k[ 5] ; char c; DATE; { nt cat; DATE max; DATE cow; double dog; too; ( ) printf ( % d, sizeof( struct date) + sizeof( max) ) ; A) 26 B) 30 C) 18 D) 8 3. ( ) A) #define printf C B) #define C, printf C) printf C, #define D) #define printf C 4. : ( struc st { nt n; struct st * next; ; static struct st a[ 3] = {5, &a[ 1 ], 7, &a[ 2 ], 9, \0, * p; p = &a[ 0] ; ) 6 A) p + + - > n B) p - > n + + C) (* p). n + + D) + + p - > n 5. ( ) struct abc { int a, b, c; ; { truct abc s[ 2] = { {1, 2, 3, {4, 5, 6 ; int t; t = s[ 0]. a + s[ 1]. b; printf( % d \n, t) ; A) 5 B) 6 C) 7 D) 8 6., a ( )
union UVB { har st[ 4] ; ; int i; long l; struct A { nt c; a; union UVB u; A) 4 B) 5 C) 6 D) 8 7. int b = 2;, ( b > > 2) /( b > > 1) ( ) A) 0 B) 2 C) 4 D) 8 8. printf( % d \ n, 12&012) ; ( ) A) 12 B) 8 C) 6 D) 012 C 9. C, ( ) A) fprintf B) fread C) fwrite D) fputc 11 1. C, ( ) A) \084 B) \ x43 C) ab D) \0 2. x y double, x = 1, y = x* 3 /2 ( ) A) 1 B) 2 C) 2. 0 D) 1. 5 3., ( ) A) int a[ ] = string ; B) int a[ 5] = {0, 1, 2, 3, 4, 5 ; C) vhst s = string ; D) int a[ ] = {0, 1, 2, 3, 4, 5 ; 4. a, 15 < a < 100 ( ) A) a > 100 a < 15 B) a < 100&&a > 15 C) a > = 100 a < = 15 D) a < = 100&&a > = 15 5. t double, t = 1, t + 5 ( ) A) 1 B) 6. 0 C) 2. 0 D) 1. 0 6. : 93
char s[ 10] ; s = abcd ; printf( % s \ n, s) ; ( ) ( ) A) abcd B) a C) abcd abcd D) 7. : int * * pp, * p, a = 10, b = 20 ; pp = &p; p = &a; p = &b; printf( % d \ n, * p, * * pp) ; ( ) A) 10, 20 B) 10, 10 C) 20, 10 D) 20, 20 8. : int u = 010, v = 0 x10, w = 10; printf( % d, % d, % d \ n, u, v, w) ; ( ) A) 8, 16, 10 B) 10, 10, 10 C) 8, 8, 10 D) 8, 10, 10 9. : char c1 = b, c2 = e ; printf( % d, % c \ n, c2 - c1, c2 - a + A ) ; ( ) A) 2, M B) 3, E C) 2, E D), 10. : char s[ 20] = programming, * ps = s; o ( ) A) ps2 B) s[ 2 ] C) ps[ 2 ] D) ps + 2, * ps 11. int i, j;, ( ) for( i = 5; i > 0; i - - ) for( j = 0; j < 4; j + + ) { A) 20 B) 25 C) 24 D) 30 12. : char * s1 = 12345, * s2 = 1234 ; printf( % d \ n, strlen( strcpy( s1, s2) ) ) ; ( ) A) 4 B) 5 C) 9 D) 10 13. : int a[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, * p = a;
C a ( ) A) * p B) a[ 10] C) * a D) a[ p - a] 14. ( ) {c ar * s = 0121 ; int k = 0, a = 0, b = 0; do { + + ; if( k% 2 = = 0) { a = a + s[ k] - b = b + s[ k] - while( s[ k]! = \0 ) ; 0 ; continue; 0 ; a = a + s[ k] - 0 ; printf( k = % d a = % d b = % d \ n, k, a, b) ; A) k = 3 a = 2 b = 3 B) k = 3 a = 4 b = 2 C) k = 2 a = 4 b = 2 D) k = 2 a = 2 b = 3 15. ( ) { nsigned a = 32768 ; printf( a = % d \ n, a) ; A) a = 32768 B) a = 32767 C) a = - 32768 D) a = - 1 16. : float x; int a, b; switch ( ) A) switch( x) B) switch( x) { case 1. 0: printf( * \ n ) ; { case 1, 2: printf( * \n ) ; case 2. 0: printf( * * \ n ) ; case 3 : printf( * * \ n ) ; C) switch ( ab) D) switch ( ab) ; { case 1: printf( \ n ) ; { case 1: printf( * \n ) ; case 2: printf( * * \n ) ; case 2 : printf( * * \ n ) ; 17. : int x, y; char a, b, c; ( ) : 2 A B C x 1, y 2, a A, b B, c C ( ) 95
A) canf( x = % d y = % d, &x, &y) ; a = getchar( ) ; b = getchar( ) ; c = getchar( ) ; B) scanf( % d % d, &x, &y) ; a = getchar( ) ; b = getchar( ) ; c = getchar( ) ; C) scanf( % d% d% c% c% c, &x, &y, &a, &b, &c) ; D) scanf( % d% d% c% c% c% c% c% c, &x, &y, &a, &a, &b, &b, &c, &c) ; 18. ( ) #include stdio. h {c ar w[ ] [ 10] = { ABCD, EFGH, IJKL, MNOP ; int k; for ( k = 1; k < 3; k + + ) printf( % s \ n, &w[ k] [ k] ) ; A) ABCD B) ABCD C) EFG D) FGH FGH EFG JK KL KL IJ O M 19. : int a[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, * p = a; 3 ( ) A) p = 2, * ( p) B) p = 2, * p C) p + = 3, * kp D) p + = 2, * p 20., x ( ) a = b = c = 0 ; x = 35; if! a) x - - ; e se if( b) x = 2 ; e se if( c) x = 3 ; else x = 4; A) 34 ) 4 ) 35 ) 3 21., ( ) A) < = B) = C) % D) && 22. : int w[ 2] [ 3], (* pw) [ 3] ; pw = w; w ( ) A) * ( w[ 0] 2) B) * ( pw1) [ 2 ] C) pw[ 0] [ 0] D) * ( pw[ 1] [ 2] )
C 23. : char str[ ] = ab \ n \012 \ \ \ ; printf( % d, strlen( str) ) ; ( ) A) 3 B) 4 C) 6 D) 12 24. : strcat( strcpy( str1, str2), str3 ) ( ) A) str1 str2, str3 B) str1 str2, str3 C) str2 str1, str3 str1 D) str2 str1, str1 str3 25. C, ( ) A) C,, B) C, C), D) C 26. ( ) A) C,,, B) C, C) C, D) C, register 27. ( ) #include stdio. h subl( char a, char b) { char c; c = a; a = b; b = c; sub2 ( char* a, char b) { char c; c = * a; * a = b; b = c; sub3 ( char* a, char* b) { char c; c = * a; * a = * b; * b = c; { har a, b; a = A ; b = B ; sub3( &a, &b) ; putchar( a) ; putchar( b) ; a = A ; b = B ; sub2( &a, b) ; putchar( a) ; putchar( b) ; a = A ; b = B ; sub1( a, b) ; putchar( a) ; putchar( b) ; A) BABBAB B) ABBBBA C) BABABA D) BAABBA 28. : 97
struct sk {int a; float b; data, * p; p = &data;, data a ( ) A) ( * p). data. a B) ( * p). a C) p - > data. a D) p. data. a 29. ( ) A) enum a = {one, two, three ; B) enum a { one, two, three ; C) enum a = { one, two, three ; D) enum a { one, two, three ; 1. a C ( bc ) 2. a = 10, b = - 10,! a + b ( ) 3.,, ( ) 4. fun void, : #define M 50 { i t a[ M] ; fun( a) ; fun, : ( ), ( ), ( ) ( : q, ) 5. fun s : 6354abc, ( ) long fun( char s[ ] ) { ong n; int sign; for( ; isspace( * s) ; s + + ) ; sign = ( * s = = - )? - 11 ;
C if( * s = = - ) s + + ; for( n = 0 ; isdigit( * s) ; s + + ) n = 10* n + ( * s - 0 ) ; return ( sign* n) ; 6. w xw, n,, void fun ( char * w, char x, int * n) { nt i, p; p = 0; w[ * n] = x; wh le ( x > w[ p] ) ( ; for( i = * n; i > p; i - - ) w[ i] = ( ; w[ p] = x; * n + + ; 7. fun1 : fun1 ( &a, &b, &c) ;, a, b, c, a vo d fun2 ( int * x, int * y) { nt t; t = * x; * x = * y; * y = t; v id fun1 ( int * pa, int * pb, int * pc) { f( * pa < * pb) fun2( ; if( * pa < * pc) fun2 ( ; if( * pb < * pc) fun2( ; 1. ( ) A) C B) C) 12 D) 99
2. ( ) A) 5E2. 0 B) E - 3 C). 2E0 D) 1. 3E 3. ( ) A) long B) 2Test C) 3Dmax D) A. dat 4. A ASCII 65, a ASCII 97, \101 ( ) A) A B) a C) e D) 5. ( ) A) n = ( i = 2, + + i) ; B) j + + ; C) + + ( i + 1) ; D) x = j > 0 ; 6. a b double, a = 5. 5, b = 2. 5, ( int) a + b / b ( ) A) 6. 500 000 B) 6 C) 5. 500 000 D) 6. 000 000 7. i, j, k int, 1, 2, 3 < >, i 1, j 2, k 3, ( ) A) scanf( % 2d% 2d% 2d, &i, &j, &k) ; B) scanf( % d % d % d, &i, &j, &k) ; C) scanf( % d, % d, % d, &i, &j, &k) ; D) scanf( i = % d, j = % d, k = % d, &i, &j, &k) ; 8. 3xn C ( ) 2 x - 1 A) 3* x^n / ( 2* x - 1) B) 3* x* * n /( 2* x - 1) C) 3* pow( x, n) * ( 1 / ( 2* x - 1 ) ) D) 3* pow( n, x) / ( 2* x - 1) 9. : long x = - 123456L;, x ( ) A) printf( x = % d \ n, x) ; B) printf( x = % ld \n, x) ; C) printf( x = % 8dL \n, x) ; D) printf( x = % LD \n, x) ; 10. : { nt k = 2, i = 2, m; m = ( k + = i* = k) ; printf( % d, % d \ n, m, i) ; ( )
C A) 8, 6 B) 8, 3 C) 6, 4 D) 7, 4 11. : int x = 3, y = 4, z = 5;,! ( x + y) + z - 1 &&y + z /2 ( ) A) 6 B) 0 C) 2 D) 1 12. y = 1, x > 0, 0, x = 0, - 1, x < 0 x y ( ) A) if( x > 0) y = 1; else if( x = = 0) y = 0 ; else y = - 1; B) y = 0; if( x > 0) y = 1; else if( x < 0 ) y = - 1; C) y = 0; if( x > = 0) if( x > 0 ) y = 1; else y = - 1; D) if( x > = 0) if( x > 0 ) y = 1; else y = 0 ; else y = - 1; 13., k = n + + ( ) A) k = n, n = n + 1 B) n = n + 1, k = n C) k = + + n D) k + = n + 1 14. : 10 4,, : ain( ) { nt n, k; float score, sum, ave; sum = 0. 0; for( n = 1; n < = 10; n + + ) { o ( k = 1; k < = 4; k + + ) { scanf( % f, &score) ; sum + = score; ave = sum /4. 0 ; printf( NO% d: % f\ n, n, ave) ;, ( ) A) sum = 0. 0; B) sum + = score; C) ave = sum/4. 0; D) printf( NO% d: % f\ n, n, ave) ; 15. : int n = 0, p; 101
do { scanf( % d, &p) ; n + + ; while( p! = 12345 &&n < 3) ; do... while ( ) A) p 12345 n 3 B) p 12345 n 3 C) p 12345 n 3 D) p 12345 n 3 16. : { nt a = 15, b = 21, m = 0; sw tch( a% 3) { ase 0: m + + ; break; case 1 switch( b% 2) { efault: m + + ; printf( % d \ n, m) ; ( ) ( ) case 0: m + + ; break; A) 1 B) 2 C) 3 D) 4 17. C,, ( ) A) void B) int C) float D) double 18. : int n = 2, * p = &n, * q = p;, A) p = q; B) * p = * q; C) n = * q; D) p = n; 19. : float fun( int x, int y) { return( x + y) ; { nt a = 2, b = 5, c = 8; printf( % 3. 0f \n, fun( ( int) fun( a + c, b), a - c) ) ; ( ) A) 8 B) 9 C) 7 D) 6 20. :
void fun( char * c, int d) { c = * c + 1 ; d = d + 1; printf( % c, % c,, * c, d) ; { har a = A, b = a ; fun( &b, a) ; printf( % c, % c \ n, a, b) ; ( ) A) B, a, B, a B) a, B, a, B C) A, b, A, b D) b, B, A, b C 13 : 1. sort a void sort( int a[ ], int n) { nt i, j, t; for( i = 0; i < n - 1; i + + ) for( j = i + 1 ; j < n; j + + ) if( a[ i] < a[ j] ) { t = a[ i] ; a[ i] = a[ j] ; a[ j] = t; { i t aa[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, i; sort( &aa[ 3], 5) ; for( i = 0 ; i < 10; i + + ) printf( % d,, aa[ i] ) ; printf( \ n ) ; ( ) A) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, B) 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, C) 1, 2, 3, 8, 7, 6, 5, 4, 9, 10, D) 1, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2. : int f( int n) 103
{ f ( n = = 1 ) return 1; else return f( n - 1) + 1; { nt i, j = 0 ; for( i = 1 ; i < 3; i + + ) j + = f( i) ; printf( % d \n, j) ; ( ) A) 4 B) 3 C) 2 D) 1 3. : { har a[ ] = { a, b, c, d, e, f, g, h, \0 ; int i, j; i = sizeof( a) ; j = strlen( a) ; printf( % d, % d \ n, i, j) ; ( ) A) 9, 9 B) 8, 9 C) 1, 8 D) 9, 8 4. reverse a : void reverse( int a[ ], int n) { nt i, t; for( i = 0 ; i < n /2; i + + ) { t = a[ i] ; a[ i] = a[ n - 1 - i] ; a[ n - 1 - i] = t; { nt b[ 10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; int i, s = 0; reverse( b, 8) ; for( i = 6 ; i < 10; i + + ) s + = b[ i] ; printf( % d \n, s) ; ( ) A) 22 B) 10 C) 34 D) 30 5. :
C { nt aa[ 4 ] [ 4] = { {1, 2, 3, 4, {5, 6, 7, 8, {3, 9, 10, 2, {4, 2, 9, 6 ; int i, s = 0; for( i = 0 ; i < 4; i + + ) s + = aa[ i] [ 1 ] ; printf( % d \n, s) ; ( ) A) 11 B) 19 C) 13 D) 20 6. : #include string. h { har * p = abcde \0fghjik \0 ; printf( % d \n, strlen( p) ) ; ( ) A) 12 B) 15 C) 6 D) 5 7. type1. h : #define N 5 #define M1 N* 3 : #include type1. h #define M2 N* 2 { nt i; i = M1 + M2; printf( % d \ n, i) ; ( ) A) 10 B) 20 C) 25 D) 30 8. : #include stdio. h { ILE * fp; int i = 20, j = 30, k, n; fp = fopen( d1. dat, w ) ; fprintf( fp, % d \ n, i) ; fprintf( fp, % d \n, j) ; 105
fclose( fp) ; fp = fopen( d1. dat, r ) ; fscanf( fp, % d% d, &k, &n) ; printf( % d% d \n, k, n) ; fclose( fp) ; ( ) : A) 20 30 B) 20 50 C) 30 50 D) 30 20 9. ( ) A), B), fclose C) fread, D) FILE 10. : #include string. h main( int argc, char * argv[ ] ) { nt i, len = 0; for( i = 1; i < argc; i + + ) len + = strlen( argv[ i] ) ; printf( % d \ n, len) ; ex1. exe ex1 abcd efg 10 < > ( ) A) 22 B) 17 C) 12 D) 9 11. : int fa( int x) { return x* x; int fb( int x) { return x* x* x; int f( int ( * f1) ( ), int ( * f2) ( ), int x) { return f2 ( x) - f1( x) ; { nt i;
C i = f( fa, fb, 2) ; printf( % d \ n, i) ; ( ) A) - 4 B) 1 C) 4 D) 8 12. : int a = 3 ; { nt s = 0 ; { int a = 5; s + = a + + ; s + = a + + ; printf( % d \ n, s) ; ( ) A) 8 B) 10 C) 7 D) 11 13. : void ss( char * s, char t) { hile( * s) { f( * s = = t) * s = t - a + A ; s + + ; { har str1[ 100] = abcddfefdbd, c = d ; ss( str1, c) ; printf( % s \n, str1) ; ( ) A) ABCDDEFEDBD B) abcddfefdbd C) abcaafefaba D) Abcddfefdbd 14. : struct STU { char num[ 10] ; float score[ 3 ] ; { struct STU s[ 3] = { { 20021, 90, 95, 85, { 20022, 95, 80, 75, { 20023, 100, 95, 90, * p = s; int i; float sum = 0 ; for( i = 0 ; i < 3; i + + ) 107
sum = sum + p - > score[ i] ; printf( % 6. 2f\ n, sum) ; ( ) A) 260. 00 B) 270. 00 C) 280. 00 D) 285. 00 15. : struct sk { nt a; float b; data; int * p; p data a, ( ) A) p = &a; B) p = data. a; C) p = &data. a; D) * p = data. a 16. : #include stdlib. h struct NODE {int num; struct NODE * next; { truct NODE * p, * q, * r; p = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; q = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; r = ( struct NODE * ) malloc( sizeof( struct NODE) ) ; p - > num = 10 ; q - > num = 20; r - > num = 30 ; p - > next = q; q - > next = r; printf( % d \ n, p - > num + q - > next - > num) ; ( ) A) 10 B) 20 C) 30 D) 40 17. : typedef int * INTEGER INTEGER p, * q; ( ) A) p int B) p int
C C) q int D) INTEGER int 18. : { nsigned char a, b, c; a = 0x3; b = a 0x8; c = b < < 1; printf( % d% d \n, b, c) ; ( ) A) - 11 12 B) - 6-13 C) 12 24 D) 11 22 19. : #include stdlib. h { har * p, * q; p = ( char * ) malloc( sizeof( char) * 20) ; q = p; scanf( % s% s, p, q) ; printf( % s % s\ n, p, q) ; abc def < >, ( ) A) def def B) abc def C) abc d D) d d 20. f n : #include string. h void f( char p[ ] [ 10 ], int n) { har t[ 20] ; int i, j; for( i = 0; i < n - 1; i + + ) for ( j = i + 1; j < n; j + + ) if( strcmp( p[ i], p[ j] ) < 0) { strcpy( t, p[ i] ) ; strcpy( p[ i], p[ j] ) ; strcpy( p[ j], t) ; { har p[ ] [ 10] = { abc, aabdfg, abbd, dcdbe, cd ; int i; f( p, 5) ; printf( % d \ n, strlen( p[ 0] ) ) ; ( ) A) 6 B) 4 C) 5 D) 3 109
1. { nt x = 10, y = 20, t = 0; if( x = = y) t = x; x = y; y = t; pr ntf( % d, % d \ n, x, y) ; 2. { nt x = 15 ; while( x > 10&&x < 50) { + + ; if( x /3) { x + + ; break; else continue; printf( % d \n, x) ; 3. : #include stdio. h { har c; while( ( c = getchar( ) )! =? ) putchar( - - c) ;, Y? N? 4. void fun( int x, int y) { = x + y; y = x - y; x = x - y; printf( % d, % d,, x, y) ; { nt x = 2, y = 3; fun( x, y) ; printf( % d, % d \ n, x, y) ; < >,
C 5. s, s = 1 + 1 /2! + 1 /3! + + 1 / n!, double fun( int n) { ouble s = 0. 0, fac = 1. 0; int i; for( i = 1 ; i < = n; i + + ) { ac = fac ( ; s = s + fac; return s; 6. #define N 10 #define s( x) x* x #define f( x) ( x* x) { nt i1, i2; i1 = 1000 / s( N) ; i2 = 1000 / f( N) ; printf( % d % d \ n, i1, i2) ; 7. void swap( int * a, int * b) { nt * t; t = a; a = b; b = t; { nt x = 3, y = 5, * p = &x, * q = &y; swap( p, q) ; printf( % d, % d \ n, * p, * q) ; 8. typedef union student { har name[ 10] ; long sno; char sex; float score[ 4] ; 111
STU; { TU a[ 5] ; printf( % d \n, sizeof( a) ) ; 9. fp, d1. dat,, : fp = fopen( ; 10. : int n, * k = &n;, k n, scanf( % d, ; printf( % d \ n, ; 11. fun : a N N, N, #include stdio. h #define N 100 int fun( int(* a) [ N] ) { nt row, col, max, min; for( row = 0; row < N; row + + ) { or( max = a[ row] [ 0 ], col = 1; col < N; col + + ) if( max = a[ row] [ col] ; if( row = = 0 ) min = max; else if( min = max; return min; 12. sstrcmp( ) s t, 0; s t, 0; s t, 0 ( strcmp( ) ) #include stdio. h int sstrcmp( char * s, char * t) { hile( * s&&* t&&* s = = { s + + ; t + + ; return ( ;
C 14 1. ( ) A) C B) C C) C D) C, 2. C ( ) A) B) if, switch, break C) for, while, do... while D) if, for, continue 3. C, ( ) A) B) C) D) 4. ( ) A) C, B) C, C) C, D) C, 5. C ( ) A) ( ) B), C), D), 6. ( n ) : int m = 32767, n = 032767; printf( % d, % o \ n, m, n) ; 113
( ) A) 32767, 32767 B) 32767, 032767 C) 32767, 77777 D) 32767, 077777 7. + + - - ( ) A) B) char int, float C) int, double float D) char int float 8. : int m = 0xabc, n = 0xabc; m - = n; printf( % x \ n, m) ; ( ) A) 0X0 B) 0x0 C) 0 D) 0XABC 9. : int m = 0, n = 0; char c = a ; scanf( % d% c% d, &m, &c, &n) ; printf( % d, % c, % d \ n, m, c, n) ; 10A10 < >, ( ) A) 10, A, 10 B) 10, a, 10 C) 10, a, 0 D) 10, A, 0 10. : { nt i; for( i = 0; i < 3; i + + ) switch( i) { ase 1: printf( % d, i) ; case 2: printf( % d, i) ; default: printf( % d, i) ; ( ) A) 011122 B) 012 C) 012020 D) 120 11. :
C { nt i = 1, j = 1, k = 2; if( ( j + + k + + ) &&i + + ) printf( % d, % d, % d \n, i, j, k) ; ( ) A) 1, 1, 2 B) 2, 2, 1 C) 2, 2, 2 D) 2, 2, 3 12. : { nt a = 5, b = 4, c = 3, d = 2 ; if( a > b > c) printf( % d \ n, d) ; else f( ( c - 1 > = d) = = 1) else printf( % d \ n, d + 1) ; printf( % d \ n, d + 2) ; ( ) A) 2 B) 3 C) 4 D), 13. : { nt p[ 7] = {11, 13, 14, 15, 16, 17, 18, i = 0, k = 0; while( i < 7 &&p[ i] % 2) { k = k + p[ i] ; i + + ; printf( % d \ n, k) ; ( ) A) 58 B) 56 C) 45 D) 24 14. : { nt i = 0, s = 0; do{ f( i% 2) { i + + ; continue; i + + ; s + = i; while( i < 7 ) ; printf( % d \ n, s) ; ( ) 115
A) 16 B) 12 C) 28 D) 21 15. : { nt i = 10, j = 1; printf( % d, % d \ n, i - -, + + j) ; ( ) A) 9, 2 B) 10, 2 C) 9, 1 D) 10, 1 16. : { har a, b, c, * d; a = \ ; b = \ xbc ; c = \0xab ; d = \0127 ; printf( % c% c% c% c \ n, a, b, c, * d) ;, ( ) A) a = \ ; B) b = \ xbc ; C) d = \0127 ; D) a = \ ; c = \0xab ; 17. : int f1( int x, int y) { nt t; if( x > y) t = x; else t = y; return( t) ; int f2( int x, int y) { nt t; if( x < y) t = x; else t = y; return( t) ;
C { nt a = 4, b = 3, c = 5, d, e, f; d = f1( a, b) ; d = f1( d, c) ; e = f2( a, b) ; e = f2( e, c) ; f = a + b + c - d - e; printf( % d, % d, % d \n, d, f, e) ; ( ) A) 3, 4, 5 B) 5, 3, 4 C) 5, 4, 3 D) 3, 5, 4 18. : void f( int x, int y) { nt t; if( x < y) { t = x; x = y; y = t; { nt a = 4, b = 3, c = 5; f( a, b) ; f( a, c) ; f( b, c) ; printf( % d, % d, % d \n, a, b, c) ; ( ) A) 3, 4, 5 B) 5, 3, 4 C) 5, 4, 3 D) 4, 3, 5 19. : #include stdio. h int a = 4, b = 3, * p, * q, * w; p = &a; q = &b; w = q; q = NULL; ( ) A) * q = 0; B) w = p; C) * p = a; D) * p = * w; 20. : int * f( int * x, int * y) { f( * x < * y) return x; else return y; { nt a = 7, b = 8, * p, * q, * r; p = &a; q = &b; 117
r = f( p, q) ; printf( % d, % d, % d \n, * p, * q, * r) ; ( ) A) 7, 8, 8 B) 7, 8, 7 C) 8, 7, 7 D) 8, 7, 8 21. : { har * s[ ] = { one, two, three, * p; p = s[ 1] ; printf( % c, % s \n, * ( p + 1 ), s[ 0] ) ; ( ) A) n, two B) t, one C) w, one D) o, two 22. : { nt x[ 8] = {8, 7, 6, 5, 0, 0, * s; s = x + 3; printf( % d \ n, s[ 2] ) ; ( ) A) B) 0 C) 5 D) 6 23. ( ) A) int N = 5, b[ N] [ N] ; B) int a[ 1 ] [ 2] = { {1, {3 ; C) int c[ 2 ] [ ] = { {1, 2, {3, 4 ; D) int d[ 3] [ 2] = { {1, 2, {3, 4 ; 24. : { nt m[ ] [ 3] = {1, 4, 7, 2, 5, 8, 3, 6, 9 ; int i, j, k = 2; for( i = 0; i < 3; i + + ) { printf( % d, m[ k] [ i] ) ; ( )
C A) 4 5 6 B) 2 5 8 C) 3 6 9 D) 7 8 9 25. :, #define N 10 void arrin( int x[ N] ) { nt i = 0; while( i < N) scanf( % d, ; ( ) A) x + i B) &x[ i + 1 ] C) x + ( i + + ) D) &x[ + + i] 26. : { har s[ ] = \n123 \ \ ; printf( % d, % d \ n, strlen( s), sizeof( s) ) ; ( ) A) B) 6, 7 C) 5, 6 D) 6, 6 27. : fun( char * sl, char * s2) { nt i = 0; while( sl[ i] = = s2[ i] &&s2[ i]! = \0 ) i + + ; return( sl[ i] = = \0 &&s2[ i] = = \0 ) ; ( ) A) s2 s1 B) s1 s2, s1 s2, 1, 0 C) s1 s2,, 1, 0 D) s1 s2, s1 s2, 1, 0 28. ( ) A) B) ( static) 119
C) D) auto static 29. : typedef struct { int n; char c; double x; STD;, ( ) A) STD tt[ 2 ] = {{1, A, 62, {2, B, 75 ; B) STD tt[ 2] = {1, A, 62, 2,, 75 ; C) struct tt[ 2] = { {1, A, {2, B ; D) struct tt[ 2] = { {1, A, 62. 5, {2, B, 75. 0 ; 30. : { nion{ unsigned int n; unsigned char c; ul; ul. c = A ; printf( % c \ n, ul. n) ; ( ) A) B) C) A D) 65 31. : { har str[ ] = xyz, * ps = str; while( * ps) ps + + ; for( ps - - ; ps - str > = 0 ; ps - - ) puts( ps) ; ( ) A) yz < > xyz B) z < > yz C) z < > yz < > xyz D) x < > xy < > xyz 32. : { nt a[ ] [ 3] = { {1, 2, 3, {4, 5, 0, (* pa) [ 3], i; pa = a; fo ( i = 0; i < 3 ; i + + ) if i < 2) pa[ 1] [ i] = pa[ 1] [ i] - 1;
C else pa[ 1] [ i] = 1; printf( % d \ n, a[ 0] [ 1] + a[ 1] [ 1 ] + a[ 1 ] [ 2] ) ; ( ) A) 7 B) 6 C) 8 D) 33. : void fun( int * a, int i, int j) { n t; if ( i < j) { = a[ i] ; a[ i] = a[ j] ; a[ j] = t; fun( a, + + i, - - j) ; { nt a[ ] = {1, 2, 3, 4, 5, 6, i; fun( a, 0, 5) ; for( i = 0; i < 6; i + + ) printf( % d, a[ i] ) ; ( ) A) 6 5 4 3 2 1 B) 4 3 2 1 5 6 C) 4 5 6 1 2 3 D) 1 2 3 4 5 6 34. : main( int argc, char * argv[ ] ) { nt n, i = 0; while( argv[ 1] [ i]! = \0 ) { = fun( ) ; i + + ; printf( % d \ n, n* argc) ; int fun( ) { tatic int s = 0; s + = 1; return s; exam. exe, : exam 123 121
( ) A) 6 B) 8 C) 3 D) 4 35., fun, p ( ) A) { int * p; fun( p) ;... int fun( int * p) { int s; p = &s; C) #include stdlib. h B) { int * p; fun( &p) ;... int fun( int * * p) { int s; * p = &s; { int * p; { int * p; D) #include stdlib. h fun( &p) ;... fun( p) ;... int fun( int * * p) int fun( int * p) { * p = ( int* ) malloc( 2) ;... { p = ( int* ) malloc( sizeof( int) ) ; 36. STP, STP s; char * s;, ( ) A) typedef STP char * s; B) typedef * char STP; C) typedef STP * char; D) typedef char* STP; 37. : struct ss { har name[ 10] ; int age; char sex; std[ 3], * p = std; ( ) ( ) A) scanf( % d, &( * p). age) ; B) scanf( % s, &std. name) ; C) scanf( % c, &std[ 0 ]. sex) ; D) scanf( % c, &( p - > sex) ) ; 38. char x 10100111, ( 2 + x) ( 3) A) 10101001 B) 10101000 C) 11111101 D) 01010101 39. ( ) A) C ASCII
B) C C) C, D) C, C 40. abc. txt, #, # nclude stdio. h { ILE * fout; char ch; fout = fopen( abc. txt, w ) ; ch = fgetc( stdin) ; while( ch! = # ) { putc( ch, fout) ; ch = fgetc( stdin) ; fclose( fout) ; ( ) A) fopen B) C) fgetc D) stdin 1. : int i = - 19, j = i% 4; printf( % d \n, j) ; 2. : { nt i, j; scanf( i = % d, j = % d, &i, &j) ; printf( i = % d, j = % d \n, i, j) ; i 10, j 20, 3. : 123
{ nt p, a = 5; if p = a! = 0) el e printf( % d \ n, p) ; printf( % d \n, p + 2) ; 4. : { nt a = 4, b = 3, c = 5, t = 0; if( a < b) t = a; a = b; b = t; if( a < c) t = a; a = c; c = t; printf( % d % d % d \ n, a, b, c) ; 5. : { nt a[ 4] [ 4] = { { 1, 2, - 3, - 4, {0, - 12, - 13, 14, { - 21, 23, 0, - 24, { - 31, 32, - 33, 0 ; int i, j, s = 0; for( i = 0 ; i < 4; i + + ) { fo ( j = 0; j < 4; j + + ) { f( a[ i] [ j] < 0) continue; if( a[ i] [ j] = = 0) break; s + = a[ i] [ j] ; printf( % d \n, s) ; 6. : { har a;
C a = H - A + 0 ; printf( % c \n, a) ; 7. : int f( int x, int y) { return( y - x) * x; { nt a = 3, b = 4, c = 5, d; d = f( f( 3, 4), f( 3, 5 ) ) ; printf( % d \n, d) ; 8. yanghui, : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 : ( 1 ) 1 1; ( 2 ) ; ( 3 ) 1 #define N 6 void yanghui( int x[ N] [ N] ) { nt i, j; x[ 0] [ 0 ] = 1; for( i = 1; i < N; i + + ) { [ i] [ 0 ] = ( = 1 ; for( j = 1 ; j < i; j + + ) x[ i] [ j] = ( ; 125
9. s, viod dele( char * s) { nt n = 0, i; for( i = 0 ; s[ i] ; i + + ) if( s[ n + + ] = s[ i] ; s[ n] = ( ; 10. findbig findbig, { nt findbig( int, int, int) ; int ( * f) ( ), x, y, z, big; f = ( ; scanf( % d% d% d, &x, &y, &z) ; big = ( * f) ( x, y, z) ; printf( big = % d \ n, big) ; 11. ( ) #define MCRA( m) 2 * m #define MCRB( n, m) 2* MCRA( n) + m { nt i = 2, j = 3; printf( % d \ n, MCRB( j, MCRA( i) ) ) ; 12. : struct ss { int info; struct ss * link; x, y, z; :
y ( C 13. test. txt, : Hello, everyone!, test. txt, fr, ( ) #include stdio. h { ILE * fr; char str[ 40 ] ; fgets( str, 5, fr) ; printf( % s \ n, str) ; fclose( fr) ; 15 ( ) 1. C, ( ) A) OL B) 4962710 C) 324562& D) 216D 2. 4, ( ) A) For B) 4d C) f2 G3 D) WORD - sub DO IF void Case Size abc define 3. ( ) A) B B) \010 C) 68 D) D 4. x y double, x = 2, y = x + 3 /2 ( ) A) 3. 500 000 B) 3 C) 2. 000 000 D) 3. 000 000 5. ( ) A) x = y = 100 B) d - - ; C) x + y; D) c = int( a + b) ; 6. x, y, x = 10, y = 3, ( ) printf( % d, % d \ n, x - -, - - y) ; A) 10, 3 B) 9, 3 C) 9, 2 D) 10, 2 7. x, y, z int, x, y, z, 127
A) INPUT x y z; B) scanf( % d% d% d, &x, &y, &z) ; C) scanf( % d% d% d, x, y, z) ; D) read( % d% d% d, &x, &y, &z) ; 8. ( ) { nt a = 3; printf( % d \n, ( a + = a - = a* a) ) ; A) - 6 B) 12 C) 0 D) - 12 9. a, b, c, d, m, n int, a = 5, b = 6, c = 7, d = 8, m = 2, n = 2, ( m = a > b) &&( n = c > d) ;, n ( ) A) 0 B) 1 C) 2 D) 3 10. : { nt x; scanf( % d, &x) ; i ( x - - < 5 ) printf( % d, x) ; else printf( % d, x + + ) ;, 5, ( ) A) 3 B) 4 C) 5 D) 6 11. w, x, y, z, m int, : w = 1; x = 2; y = 3; z = 4; m = ( w > x? w: x > y? x: y > z? y: z), m ( ) A) 4 B) 3 C) 2 D) 1 12. int,, t 0 while( t = l ) { ( ) A) 0 B) 1 C) D) 13. ( ) { nt num = 0;
C w ile( num < = 2) { num + + ; printf( % d \n, num) ; A) 1 B) 1 C) 1 D) l 2 2 2 3 3 4 14., ( ) A) typedef v1 int; B) typedef v2 = int; C) typedef int v3 ; D) typedef v4: int; 15.,, ( ) A) B) C), D) 16. ( ) fun ( float x ) { loat y; y = 3* x - 4; return y; A) int B) C) void D) float 17. : f ( int a) { nt b = 0; static int c = 3 ; b + + ; c + + ; return( a + b + c) ;, ( ) { nt a = 2, i; for( i = 0; i < 3 ; i + + ) printf( % d \ n, f( a) ) ; A) 7 B) 7 C) 7 D) 7 129
8 9 10 7 9 11 13 7 18. ( ) { har c = z ; printf( % c, c - 25 ) ; A) a B) z C) z - 25 D) y 19., ( ) A) \ t B) \17 C) n D) \xaa 20. : int i, j = 2, * p = &i;, i = j ( ) A) i = * p; B) * p = * &j; C) i = &j; D) i = * * p; 21., ( ) A) int a[ ] = {1, 2 ; B) char * a[ 3] ; C) char s[ 10] = test ; D) int n = 5, a[ n] ; 22. int, : int x[ 10 ] = {0, 2, 4 ;, x ( ) A) 3 B) 6 C) 10 D) 20 23. ( ) { nt i, a[ 10] ; for( i = 9; i > = 0; i - - ) a[ i] = 10 - i; printf( % d% d% d, a[ 2], a[ 5], a[ 8 ] ) ; A) 258 B) 741 C) 852 D) 369 24. ( ) A) int a[ 2] [ 3 ] ; B) int b[ ] [ 3] = {0, 1, 2, 3 ; C) int c[ 100] [ 100] = {0 ; D) int d[ 3] [ ] = { {1, 2, {1, 2, 3, {1, 2, 3, 4 ; 25. ( ) { nt a[ 4] [ 4 ] = { {1, 3, 5, {2, 4, 6, {3, 5, 7 ; printf( % d% d% d% d \ n, a[ 0] [ 3 ], a[ 1] [ 2], a[ 2] [ 1], a[ 3 ] [ 0] ) ;
C A) 0650 B) 1470 C) 5430 D) 26. ( ) { har st[ 20] = hello\0 \ t \ \ \ ; printf( % d % d \n, strlen( st), sizeof( st) ) ; A) 9 9 B) 5 20 C) 13 20 D) 20 20 27., ( ) A) char s1[ 10] ; s1 = Ctest ; B) char s2 [ ] = { C, t, e, s, t ; C) char s3 [ 20] = Ctest ; D) char * s4 = Ctest \n ; 28. ( ) #include stdio. h amovep( int * p, int ( * a) [ 3], int n) { nt i, j; fo ( i = 0; i < n; i + + ) for j = 0 ; j < r; j + + ) * ( ( p + i* n) + j) = * ( * ( a + i) + j) ; { nt * p, a[ 3] [ 3] = { {1, 3, 5, {2, 4, 6 ; p = ( int * ) malloc( 100) ; amovep( p, a, 3) ; printf( % d % d \n, p[ 2], p[ 5] ) ; free( p) ; A) 5 6 B) 2 5 C) 3 4 D) 29. ( ) struct HAR { int x, y; struct HAR * p; h[ 2 ] ; { [ 0]. x = 1; h[ 0 ]. y = 2; h[ 1]. x = 3; h[ 1 ]. y = 4; 131
h[ 0]. p = &h[ 1] ; h[ 1]. p = h; printf( % d % d \n, ( h[ 0 ]. p) - > x, ( h[ 1]. p) - > y) ; A) 1 2 B) 2 3 C) 1 4 D) 3 2 30. ( ) { nt a, b; f r( a = 1, b = 1 ; a < = 100; a + + ) { f( b > = 10 ) break; if b% 3 = = 1) { b + = 3; continue; printf( % d \ n, a) ; A) 101 B) 6 C) 5 D) 4 31. ( ) union myun { truct a; { int x, y, z; u; int k; {. u. x = 4; a. u. y = 5; a. u. z = 6; a. k = 0; printf( % d \ n, a. u. x) ; A) 4 B) 5 C) 6 D) 0 32. ( ) int a, b; void fun( ) { a = 100; b = 200; { nt a = 5, b = 7; fun( ) ;
C printf( % d % d \n, a, b) ; A) 100 200 B) 5 7 C) 200 100 D) 7 5 33. ( ) #define M( x, y, z) x* y + z { nt a = 1, b = 2, c = 3; printf( % d \ n, M( a + b, b + c, c + a) ) ; A) 19 B) 17 C) 15 D) 12 34. x y 0,, ( ) A) x y B) x y C) x & y D) x y 35., test. txt ( ) #include stdio. h void fun( char * fname, char * st) { ILE * myf; int i; myf = fopen( fname, w ) ; for( = 0; i < = 6; i + + ) fputc( * ( st + i), myf) ; fclose( myf) ; { un( test, new world ) ; fun( test, hello, ) ; A) hello, B) new worldhello, C) new world D) hello, rld 1. : x + + ; + + x; x = x + 1; x = l + x; x 1, ( ) : 2. y int, y : 3. 133
{ nt i = 10, j = 0; do { = j + i; i - - ; while( i > 2) ; printf( % d \n, j) ; 4. : { nt n1, n2 ; scanf( % d, &n2) ; while( n2! = 0) { n1 = n2% 10; n2 = n2 /10 ; printf( % d, n1) ;, 1298 < >, 5. int ff( int n) { tatic int f = l; f = f* n; return f; { nt i; for( i = 1 ; i < = 5; i + + ) printf( % d \ n, ff( i) ) ; 6. x y, double fun( double x, int y) { nt i; double z; for( = 1, z = 1; i < = y; i + + ) return z; z = z* ( ;
C 7. : { nt a, b, k = 4, m = 6, * p1 = &k, * p2 = &m; a = pl = = &m; b = ( * p1) /( * p2) + 7 ; printf( a = % d \n, a) ; printf( b = % d \ n, b) ;, a b 8. int a[ 10], i;, fun : 10 1, 2, 3, 4, 5, 6, 7, 8, 9, 10; a 10, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 fun( int a[ ] ) { nt i; for( i = 1; i < = 10; i + + ) ( = i; for( i = 0; i < 5; i + + ) ( = a[ i] ; 9. #include stdio. h { har s[ ] = 9876, * p; for ( p = s; * p! = \0 ; p + + ) putchar( * p) ; 10. : char s[ 100], d [ 100 ] ; int j = 0, i = 0; s, ( : ) while( [ i] ) { d[ j] = ( ; j + + ; d[ j] = 0 ; 11., struct STRU { nt x, y ; float rate; ( p; a, b; a. x = 0; a. y = 0; a. rate = 0; a. p = &b; 135
b. x = 0; b. y = 0; b. rate = 0; b. p = NULL; 12. : struct STRU { nt a, b ; char c; double d; ; struct STRU p1, p2;, t, t : [ 20 ] ; 13., fseek, ftell,, FILE * myf; ling f1; myf = ( ( test. txt, rb ) ; fseek( myf, 0, SEEK END) ; f1 = ftel( myf) ; fclose( myf) ; printf( % d \ n, f1 ) ;
1 C 1. 2., 3., 4. ( ) 1. 2. 3. : ( ), ( RAM ROM), ( ), ( ), ( ) 4., ;, ; ( ) 5. ( ) ; ( ) 6. ; 7. 8. ( ) DOS 1. 2. DOS
3. 4. DOS, : ; ( TYPE, COPY, DEL, REN, XCOPY, ATTRIB) ; ( DIR, MD, CD, RD, TREE, PATH) ; ( FORMAT, DISKCOPY, CHKDSK) ; ( VER, DATE, TIME, CLS, PROMPT, HELP) ; (, ) ; ( ) Windows 1. Windows 2. Windows : 3. Windows : 1. 2. 3. C ++, Access, Visual Basic, Visual FoxPro, Java C, 1. ( ) 2. 3.,, C 1. C ( 1 ), ( 2 ) ( 3 )
1 C ( 4 ) C 2. ( 1 ) C ( ) ( 2 ) C ( 3 ) ( 4 ) C ( ) 3. ( 1 ),, ( 2 ), ( 3 ) ( 4 ) goto 4. ( 1 ) if ( 2 ) switch ( 3 ) 5. ( 1 ) for ( 2 ) while do... while ( 3 ) continue break ( 4 ) 6. ( 1 ) ( 2 ) 7. ( 1 ) ( 2 ) ( 3 ) ( 4 ), ( 5 ),, ( 6 ) ( 7 ) ( ), ( 8 ) 8. 139
( 1 ),, ( 2 ) 9. ( 1 ), ( 2 ), ( 3 ) ( 4 ) ( 5 ),, 10. ( ) ( ) ( 1 ) ( 2 ), 11. ( 1 ) ( 2 ) 12. ( I /O ), ( I / O ) ( 1 ) ( FILE ) ( 2 ) ( fopen, fclose) ( 3 ) ( fputc, fgetc, fputs, fgets, fread, fwrite, fprintf, fscanf ), ( rewind, fseek )
2 Tu rb o C Turbo C C,, C Turbo C, Turbo C C Turbo C Tur bo C Turbo C 384KB, 3MB, ( 286 386 486 586 ) Turbo CTurbo C ( ), ( ), Turbo C DOS C, DOS2. 0 DOS Turbo C, Tur bo C Turbo C Borland, Turbo C Turbo C, Turbo C, Turbo C, Turbo C ( install) Turbo C install. exe ( install. exe A, CD A: A: ), install install. exe,,,,
,, ( C, F ) : ( 1 ) F: \ TC : tc. exe, tcc. exe, make. exe ( 2 ) F: \ TC\ INCLUDE : stdio. h, math. h, string. h ( 3 ) F: \ TC\ LIB : maths. lib, mathl. lib, graphics. lib Tur bo C, TC tc. exe, tcc. exe tc. exe Turbo C tc. exe, : ( 1) MS-DOS, DOS, DOS : C: \ Windows > CD F: \ TC ( F: \TC) F: \ TC > tc ( tc. exe) Turbo C ( 2 ) TC, tc. exe,, TC. exe Turbo C, Tur bo C 1 Turbo C : ( 1 ) TC, 8 : File( ) Edit( ) Run( ) Compile ( ) Project( ) Options( ) Debug ( ) Break / watch( / ), ( 2 ), Edit Turbo C, Turbo C : Line 1 Col 1 Insert Indent Tab Fill Unindent F: NONAME. C
2 Turbo C 1 Line 1 Col 1 1 1, Line Col,, NONAME. C, NONAME. C, ( 3), Message ( 4 ) Turbo C ( ), : F1-Help( ) : F1 F5-Zoom( ) :,, F5,, F5,, F5,,, F5, F6-Switch( ) : F6 ( Message), F6, ( Edit ), 143
F7-Trace( ) : F8-Step( ) : F8 F9-Make( ) :,. obj. exe, F10 -Menu( ) :, File( File ) Trubo C, C, File ( TC, File ;, F10 File ),, New( 2 ),,, ( 1 1 ) 2 Turbo C,, Ins Del Ins, Ins, INSERT, (,
2 Turbo C ), ; Ins,, INSERT, ( ) Turbo C Ins, Ins, Del Ctrl Y ; Ctrl N,, F10, Save, TC,, 3 3 3, (,, ), : ( 1 ) TC tc. exe Turbo C, F: \ TC,, ( 2 ) NONAME. C,, NONAME. C,, NONAME. C, C1. C, F: \ TC\ C1. C,, TC, C1. C TC,, F: \ TC\ ZHANG \ C1. C,, TC ZHANG : C1. C, C1. C TC 145
C1. C, C1. C, NONAME. C, C1. C,, Save,,, F10, FileSave, : F2, ( ) F2, F10, File Load, *. C, TC ZHANG C1. C,, 4,, F3 F3, F10, FileLoad 4 ( ),, ( ),,,, *. C, Turbo C. C,
2 Turbo C,,, F2, File ( Alt + F File ), Write to, New Name, 5 C1. C, ( C2. C),, ( ), C2. C, 5, C2. C ZHANG,, F: \ TC\ ZHANG \C2. C 5,,, C, QBASIC,,,, TC cd, TC, TC : Alt + F File, Change dir ( Change dir ), New Directory, F: \ TC, ( 147
F: \TC Turbo C, ) F: \ TC\ ZHANG, Turbo C ZHANG, Turbo C New Directory F: \ TC \ ZHANG, 6 (. obj. exe ),, 6,,,, TC,, (. obj ) (. exe ) F: \ TC\ ZHANG OUT, TC, TC: Turbo C Turbo C,, F: \ TC, TC INCLUDE, LIB Turbo C,, Turbo C, Turbo C
2 Turbo C Turbo C, Options, Options ( Alt + O ),, Directories, 7 7 7 : ( 1 ) Include directories: F: \ TC \ INCLUDEInstall ( 2 ) Library directories: F: \TC \LIBInstall ( 3 ) Output directory: *. exe *. obj ( 4 ) Turbo C directory: F: \ TCInstall 1 Include directories, F: \TC \INCLUDE 2 Library directories, F: \TC\LIB 3 Output directory (. obj. exe ), 7,,, 3 Output directory ( ),, Output Directory, F: \TC \ZHANG OUT, 8,. obj. exe F: \ TC\ ZHANG OUT,, F: \ TC \ ZHANG OUT 3 Output directory:, 4 Turbo C directory Turbo C, F: \ TC, 149
8,, ( config) Turbo C tcconfig. tctc, TC tcconfig. tc,, : Esc Options, Save Options,, Config File, 9 TCCONFIG. TC,, TCCONFIG. TC 9 TCCONFIG. TC, TC,,, TC, TC ( ), Options Directories,, Save Options
2 Turbo C,,,. obj. exe,, DOS \ TC\ tcturbo C,. obj. exe, Windows TC ( ), TC tc. exe Turbo C, Alt + F File, Change dir ( ),, Turbo C,,,,,, 1. ( 1 ) F10, Compile ( Alt + C ), Compile, 10 10 151 Compile to OBJ,
cl. c, cl. obj, L cl. obj TCCONFIG. TC,, (. exe),. exe F10 CompileLink EXE File, ( Alt + C L ),, TCCONFIG. TC cl. exe,,. obj, ( 2 ) Alt + C ( F10 Compile) Compile, Make EXE file,, TCCONFIG. TC c1. obj c1. exe, Turbo C, F9 -Make : F9 ( Compile) Make EXE file,, F9 2.,,. obj (. obj ), Turbo C,,,, : Turbo C,, c1 1. c c1 2. C, TC, 11 File Write to, c1. PRJc1
2 Turbo C ( ),. PRJ, ( PRJ project ) Alt + P ( F10 Project, ) ( Project) Project name,, Project Name, ( *. PRJ, ) c1. PRJ, c1. PRJ, ( 12), 11 12 Alt + C Compile, Make EXE file,, c1 1. OBJ c1 2. OBJ c1. EXE :,, : c1 1 c1 2 : c1 1. C c1 2. C, : 153
F: \ TC\ ZHANG \c1 1 F: \ TC\ ZHANG \c1 2, c1 1. C c1 2. C, c1 1. OBJ c1 2. OBJ, : c1 1. OBJ c1 2. OBJ Make EXE filef9, (. PRJ ) Project name,,,, Project name ( Project Clear Project ),. RPJ, Make EXE file C1. RPJ, Make EXE file F: C1. EXE, C1, NONAME. EXE( NONAME. C) Compile to OBJ( Make EXE file),, Compile to OBJ 3. ( 1 ),, 13 : Compiling 1 A1. C 2 A1. C 7, 0, 0 2 253KB 1 ( Success),,, 14 : A1. EXE,
2 Turbo C 13 14 F TC LIB CS. LIB,,, ( 2 ), : { nt a, b, d; a = 3 ; b = 5 c = a + b; 155
d = 7; printf( % d, % d, % d \ n, a, b, c, ) ; F9, 15 15 15, 1 2 ( Warnings),,, ( Errors),,,,, Message,, 16 1 2, 5, : Statement missing; in function main( ) 16,, Edit 5, 4, 5 5? 4,,, C, 5, 5
2 Turbo C 16 5, 5, 5,,,,, 5,, 4, 2 F6 Message, 2, 17 17 157
Message 2, 7, : Undefined symbol c in function main( c ) 7, c,,, 7, 2 : int a, b, c, d; 3 8 : d is assigned a value which is never used in function main( d, ), d,,,,, d,,,,,,. obj. exe ( ) 8, 8, 7 d, 8, 7 : printf ( % d, % d, % d, % d \n, a, b, c, d) ; a, b, c, d, F9, 18 18
2 Turbo C 18, ( ),,, ( ),, 4.,,,, : Alt + P Project, Break make on,, Errors, Break make on Errors, 19 19,,, Warnings,, ( Warnings Errors),,, Break make on Fatal errors,,, Link, 159
,. OBJ. EXE,, ( 1 ) DOS. EXE, C1. EXE, : F: \ TC\ ZHANG > 1 ( ) C1. EXE, C1. EXE \ TC\ OUT, : F: \ TC\ ZHANG > TC\OUT\ C1,,. OBJ ( 2 ) TC F10, Run, ( Alt + R ), Run, 20 20 Run, ( 3 ) Ctrl + F9 20, Run Run Ctrl - F9, Run Ctrl + F9,, TC Ctrl + F9,, Ctrl + F9,,,, Ctrl
2 Turbo C + F9 Turbo C Turbo C,,, Ctrl + F9 ;,, ( scanf ),, : { nt a, b, c; scanf( % d, % d, % d \n, &a, &b, &c) ; printf( a = % d, b = % d, c = % d \ n, a, b, c) ; Ctrl F9,,, : 2, 4, 6( 21), TC,, Run User screen ( User screen ) Alt + F5,, 22, printf 21 22,, TC : F9: Ctrl + F9 : Alt + F5:, TC 161
, 1. :,,, [ 1] :, : :, s = ( a + b + c) /2 : # include math. h { loat a, b, c, s, area; = s( s - a) ( s - b) ( s - c) scanf( % f, % f, % f, &a, &b, &c) ; s = ( a + b + c) /2; area = sqrt( s* ( s - a) * ( s - b) * ( s - c) ) ; printf( area = % d \n, area) ;, : 2. 5, 3. 6, 4. 7 : area = 0,,, F7, main ( ), Watch F7, 4 ( 3,, ), 23, main ( ), scanf, F7, 4 4 scanf,,,
2 Turbo C 23 : 2. 5, 3. 6, 4. 7,, 5, 4 F7, 6, 5 Ctrl + F7, a, a, 24 24, Watch a 2. 5, 25 b, Ctrl + F7, Add Watch b,, Watch b 3. 6 163
25 c 4. 7, s 5. 4, Watch : s : 5. 4 c : 4. 7 b : 3. 6 a : 2. 5 a, s,, F7, 7, 6 Ctrl + F7, Add Watch area, Watch area 4. 442025, 0, printf 0? F7, 8, 7,, Watch area 4. 442025, area, printf printf,, Alt + F5, area = 0,, printf,,, % d, % d % f, Ctrl + F9 2. 5, 3. 6, 4. 7, : area = 4. 442025,,,, F7 Ctrl +
2 Turbo C F7, Run Trace into ( 26), F7 Break /watch, Add watch( 27 ),, Add Watch, Ctrl + F7, 26 27 2.,,,,,,,,,,,,, :, Ctrl + F8,,,, Ctrl + F8,,,,, Ctrl + F9 [ 2] ax 2 + bx + c = 0, x1 x2, : 165
: x1 = p + q, x2 = p - q, : # include math. h { loat a, b, c, disc, p, q, x1, x2; scanf( % f, % f, % f, &a, &b, &c) ; disc = b* b - 4* a* c; p = - b /( 2 * a) ; q = sqrt( disc) /( 2 * a) ; x1 = p + q; x2 = p - q; p = - b 2a, q = b 2-4ac 2a printf( x1 = % d, x2 = % d \n, x1, x2) ; Ctrl + F9, a, b, c 1, 2, 1, Alt + F5, : x1 = 0, x2 = 0, 6 11,, Ctrl + F8, Ctrl + F9, scanf,, a, b, c : 1, 2, 1,,, disc, Ctrl + F7, Add Watch disc, Watch disc: 0. 0, disc = b 2-4ac 0, disc = 0,, Ctrl + F9,, printf Ctrl + F7 x1 x2, Watch x1 x2-1. 0,, 28,, x1 x2, % d, printf % d % f,, :
2 Turbo C 28 x1 = - 1. 000000, x2 = - 1. 000000 ( ), a, b, c 2, 3, 5, Ctrl + F7 disc Watch : disc: - 31. 0,,, disc, x1 = p + q;, Ctrl + F9, q = sqrt( disc) / ( 2 * a) ; (, TC ), Alt + F5, : sqrt: DOMAIN error Floating point error: Overflow sqrt, ( sqrt 0, ),, printf a, b, c,, a, b, c b 2-4ac0, TC Debug Debug Evaluate 29, Ctrl + F4 Evaluate,,, 167
29 [ 3] ax 2 + bx + c = 0, a, b, c, disc < 0,, a c, b, disc0 b ( ) b, 2 : # include math. h { loat a, b, c, disc, p, q, x1, x2; scanf( % f, % f, % f, &a, &b, &c) ; do{ isc = b* b - 4* a* c; while( disc < 0) ; p = - b /( 2 * a) ; q = sqrt( disc) /( 2 * a) ; x1 = p + q; x2 = p - q; printf( x1 = % f, x2 = % f\ n, x1, x2) ; do... while, b disc b, b, 3 F7,, a, b, c 2, 3, 5,, TC, 6 F7, 7, disc disc, Ctrl + F4 ( Debug Evaluate ), 3, : Evaluate( ) Result( ) New value ( ) disc, Evaluate disc, Result - 31. 0 disc < 0,, b b,
2 Turbo C Evaluate b,, Result b 3. 0 New value, b 4,,, Result 4. 0, 30 30, b F7, 6 ( disc < 0 ), F7, 7, disc Ctrl + F4 Evaluate, Evaluate disc, Result disc - 24. 0, b Evaluate b, New value b 5, F7, disc - 15. 0b, b 6, disc - 4. 0 b 7, disc 9. 0 disc,, b = 7,,,,,,, Tur bo C TC,,, 169
1. File 1 File 1 File Load,,, *. C *. PRJ,, Pick New Save Write to Directory Change dir Os shell Pick, TC ( 8 ),, Pick, Alt + F3 Pick File Load( F3) Pick, Load file File Load, ( NONAME. C) ( NONAME. C), TC,,, DOS cd TC, DOSTC, exit TC Quit TC, DOS 2. Edit TC Edit, Edit,, Turbo C 2 TC
2 Turbo C 2 TC Ctrl + A Ctrl + F Ctrl + QR Ctrl + QC Ctrl + QE Home Ctrl + QX End Ctrl + QP Ctrl + W Page Up Ctrl + Z Page Down Ctrl + QB Ctrl + QK Insert Insert on / off Ctrl + Y Del Ctrl + T Backspace Ctrl + QY Ctrl + N Ctrl + KB Ctrl + KH / Ctrl + KK Ctrl + KV Ctrl + KT Ctrl + KR Ctrl + KC Ctrl + KW Ctrl + KY Ctrl + U Ctrl + KQ Ctrl + P Ctrl + QF Ctrl + OI Indent on / off Ctrl + QA Ctrl + OT Tab on / off Ctrl + QV Ctrl + F1 Tab Ctrl + KD : Ctrl + QE Ctrl Q E 171
3. Run 3 Run 3 Run Debug Run Source debug on, ;, Program rest Go to cursor Trace into Step over User screen,,,,, ESC,,,, ( ) 4. Compile 4 Compile 4 Compile, Primary C file Compile to OBJ Make EXE file Primary C file,. C,. OBJ. EXE. OBJ,. OBJ,,. EXE. OBJ. EXE,,. OBJ : Project name. PRJ ; Primary C file. C ;. C
2 Turbo C Link EXE file Build all Primary C file Get info. OBJ,. EXE CompileMake EXE file,,, Make,, 5. Pr oject 5 Project 5 Pr oject Project name Break make on Auto dependencies Clear project Remove message,. PRJ. EXE. PRJ Make, 4 : Warning:, ( Warning), Error:,, Fatal Error:,, Link: Make,. OBJ On:. C. OBJ TC. OBJ. C. OBJ, Off: Project name 173
6. Debug 6 Debug 6 Debug Evaluate Call stack Find function Refresh display, 3 : ( Evaluate) ( Result) ( New value), BreakWatchAdd watch,,,,, 3 : Smart( ) :, Display swapping None: Always:, 3 : Source debugging On:, Standalone:, Turbo debugger None: 7. Break / watch 7 Break / watch 7 Break / watch Add watch Add watch,, Watch
2 Turbo C Delete watch Edit watch Remove all watches Toggle breakpoint Clear all breakpoint View next breakpoint Watch, Del Ctrl + Y, ( Watch ), 8. Options Options 7 Options,, ( 1 ) Compiler, 8 8 Model, Tiny, Small, Medium, Compact, Large, Huge 6 Defines, Code generation, 175
Optimization, Source,, : Identifier length:, 32, 1 32 Nested comments: On ; Off ANSI keywords only: On ANSI C, Turbo C ; Off Turbo C Errors Names, BSS,, ( 2 ), 9 9 Map file On:. MAP Off: Initialize segments Default libraries On: ( ) Off:,, On: Off:
2 Turbo C Graphics library Warn duplicate Symbols Stack warning Case-sensitive link On: ( ) Off:,, Off. PRJ Graphics. lib,. OBJ. LIB On:. OBJ. LIB Off: No stack On: No stack ( Small ) Off: No stack On: Off: ( 3 ) Environment :,, 10 10 Message tracking Keep message Config auto save, TC Current file: All file: Off: Make Yes:, Make No: Make On: Run / Run File / Os shell( Quit ),, TC Off: 177
Edit save auto On: Run / Run File / Os shell( Quit), Off: Backup files On:,. BAK,, Off: Tab size Zoomed windows Screen size ( Tab) 8, 2 16( Tab mode on) F5, ( ),, 25, EGA 43, VGA 50 ( 4 ) Directories,, 11 11 Include directories Library directories Output directory Turbo C directory Pick file name Current pick file TC, pick TCPICK. TCP, TC pick, Current pick file ; pick, pick pick,
2 Turbo C 9.,, 12 12 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 Shift + F10 Alt + F5 Alt + F7 Alt + F8 Alt + F9 Ctrl + F1 Ctrl + F2 Ctrl + F3 Ctrl + F4 Ctrl + F7 Ctrl + F8 Ctrl + F9, TC, FileSave, FileLoad, RunGo to cursor, OptionsEnviornmentZoomed windows,, RunTrace into,, RunStep over, CompileMake, RunUser screen,. OBJ, DebugCall stack, DebugEvaluate, BreakWatchAdd watch, BreakWatchToggle breakpoint, RunRun 179
Alt + C Alt + D Alt + E Alt + F Alt + O Alt + P Alt + R Alt + X Esc Debug File Options Project Run TC, DOS Tur bo C Turbo C : ( 1) ( fatal error) :,,, ( 2) ( error) :, ( ) ( 3) ( warning) :,,,,, : C,,, 1.
2 Turbo C ( Bad call of inline function ) Irreducible expression tree Register allocation failure, 2. # operator not followed by macro argument name#,# # xxxxxxxx not an argument xxxxxxxx, Ambiguous symbol xxxxxxxx xxxxxxxx ( ),, Argument # missing name #, Argument list syntax error,, 181
Array bound missing ( ] ), Array size too large, Assembler statement too long 480 Bad configuration file TURBOC. CFG ( - ) Bad file name format in include directive ( filename. h ) ( < filename. h > ),, ( ) Bad ifdef directive syntax ifdef #ifdef ( ) Bad ifndef directive syntax ifndef #ifndef ( ) Bad undef directive syntax undef #undef ( ) Bad file size syntax 1 16 Call of non-function,
Cannot modify a constant object 2 Turbo C ( ) Case outside of switch case switch case switch, Case statement missing: case : case Case syntax error case case Character constant too long Compound statement missing,, Conflicting type modifiers, ( near far) ;,, ( cdecl pascal interrupt) Constant expression required #define Could not find file xxxxxxxx. xxx Declaration missing ; ; xxxxxxxx. xxx, ( ; ) 183
Declaration needs type or storage class, i, j; Declaration syntax error, Default outside of switch Default switch default switch, Define directive needs an identifier Define # define, Division by zero, Do statement must have while do while while do, Do while statement missing ( do while ( do, while Do while statement missing ) do while ) do, Do while statement missing; do while do, Duplicate case case switch case Enum syntax error enum enum
Enumeration constant syntax error emum, 2 Turbo C Error Directive: xxxx : xxxx #error, Error writing output file,, Expression syntax error,, Extra parameter in call, Extra parameter in call to xxxxxx xxxxxx ( ) File name too long #include, DOS 64 For statement missing ( for ( for For statement missing ) for ) for, For statement missing ; for ; for, Function call missing ) ) 185
, Function definition out of place,, Function doesn t take a variable of argument va start, Goto statement missing label goto goto If statement missing ( if ( if, if If statement missing ) if ) if, Illegal character c ( 0 xxx) c ( 0xXX), Illegal initialization, extern, static Illegal octal digit ( 8 9) Illegal pointer subtraction Illegal structure operation
2 Turbo C (. ) ( &) ( = ),, Illegal use of floating point (? : ) ( * ), Illegal use of point ( * ), Improper use of a typedef symbol typedef typedef, In-line assembly not allowed,, TCC Incompatible storage class extern, static ( ) Incompatible type conversion,,,, xxxxxxxx Incorrect command line argument: xxxxxx Incorrect configuration file argument: xxxxxxxx : xxxxxx : 187
( -) Incorrect number format Incorrect use of default default default Initialize syntax error, Invalid indirection ( * ) Invalid macro argument separator,, Invalid pointer addition Invalid use of arrow Invalid use of dot (. ) L value required, Macro argument syntax error
2 Turbo C, Macro expansion too long 4 096, May complied only one file when an output file name is given, - o,,, Mismatch number of parameters in definition Misplaced break break break switch Misplaced continue continue continue Misplaced decimal point Misplaced else else else if else, if Misplaced elif directive elif #elif #if #ifdef #ifndef Misplaced else directive else #else #if #ifdef #ifndef 189
Misplaced endif directive endif #endif #if #ifdef #ifndef Must be addressable ( &), Must take address of memory location ( &) ( &), No file name ending #include, ( ) ( > ) No file name giver Turbo C ( TCC) Non-portable pointer assignment,, Non-portable pointer comparison ( ), Non-portable pointer conversion,,, Not an allowed type, Out of memory,
2 Turbo C Pointer required on left side of - > - > - > Redeclaration of xxxxxxxx xxxxxxxx Size of structure or array not known ( sizeof ), ;, Statement missing ; ; Structure or union syntax error ( ) structure union ( { ) Structure size too large,, Subscripting missing ] ] Switch statement missing ( ( switch, switch Switch statement missing ) ) switch, Too few parameters in call ( ) 191
Too few parameter in call to xxxxxx xxxxxx ( ), Too many cases case switch 257 case Too many decimal points Too many default cases default switch default Too many exponents Too many initializers Too many storage classes in declaration Too many types in declaration : char int float double struct union enum typedef Too much auto memory in function Too much code define in file 64K
2 Turbo C Too much global data define in file 64K, Two consecutive dots (... ), (. ), C Type mismatch in parameter # #, #N( N 1) Type mismatch in parameter # in call to xxxxxx xxxxxx, ( N 1) Type mismatch in parameter xxxxxxx xxxxxxx, Type mismatch in parameter xxxxxxxxin call to yyyyyyyy yyyyyyyy xxxxxxxx, Type mismatch in redeclaration of xxx,, extern Unable to create output file xxxxxx. xxx xxxxxx. xxx, ;, 193
Unable to create turboc. lnk turboc. lnk turboc. lnk, Unable to execute command xxxxxxxx TLINK MASM, xxxxxxxx Unable to open include file xxxxxxxx. xxx xxxxxxxx. xxx #include, CONFIG. SYS ( files = 20) Unable to open input file xxxxxxx. xxx xxxxxxx. xxx Undefined label xxxxxxxx goto xxxxxxxx Undefined structure xxxxxxxx xxxxxxxx Undefined symbol xxxxxxxx xxxxxxxx,, Unexpected end of file in comment started on line ( * / )
2 Turbo C Unexpected end of file in conditional started on line # # #endif, #endif Unknown preprocessor directive xxx xxx #, : define undef line if ifdef inndef include else endif Unterminated character constant Unterminated string Unterminated string or character constant User break Ctrl + Break While statement missing ( while ( while, while While statement missing ) while ) while, while Wrong number of arguments in of xxxxxx, 3. xxxxxxxx declared but never used xxxxxx xxxxxxxx, 195
, xxxxxxx is assigned a value which is never used xxxxxxx, xxxxxxxx not part of structure xxxxxxxx (. ) ( - > ),, Ambiguous operators need parentheses, ;,, Both return and return of a value used, return return, return Call to function with prototype,, Call to function xxxxwith prototype xxxx, xxxx, Code has no effect, a + b ;,, Constant is long long 32767, 65535, I L, long
Constant out of range in comparison 2 Turbo C, - 1 32767( ), unsigned ( : ( unsigned) 65535) U u ( : 65535 u) Conversion may lose significant digits, long unsigned long int unsigned int, int long,,, 4000, - 1, 8087, - 1 Function should return a value int, void, int, C, void Mixing pointers to signed and unsigned char signed unsigned char,, No decaration for function xxxxxxxx xxxxxxxx,,, ( ) Non-portable point assignment,, Non-portable pointer comparison ( ) 197
, Non-portable return type conversion return,,,, Parameter xxxxxxxx is never used xxxxxxxx,, ( ),, Possible use of xxxxxxxbefore definition xxxxxxx,,,, Possible incorrect assignment ( if while do... while ),,,, : if( a = b) if( ( a = b)! = 0) Redefinition of xxxxxxxx is not identical xxxxxxxx,, Restaring compiler using assembly - B # programe inline asm,
2 Turbo C Structure passed by value,,, ( &), Superfluous & with function or array & ( &), Suspicious pointer conversion,, Undefined structure xxxxxxxx xxxxxxxx, Unknown assembler instruction,, Unreachable code break continue goto return while do for, Void function may not return a value void void,, Zero length structure, 199
3 1 1. C, obj, exe 2. 3. 4. 5. 6., ( ), 7. 2, 4, 1 8. 1 9. 2 10. - 60 11. 26 12. 12, 4 13. f102 14. 15. / * * / 16. ; ( ) 17. 18. d, f, c 19. % f, x 20. scanf( % d% d, &a, &b) ; 21. printf( % 5d% 5d \ n, a, b) ; 22. printf( % 6. 2f, 6. 2f \n, x, y) ;
3 1 2 3 4 5 6 7 8 9 10 A C A B A A C A B B 11 12 13 14 15 16 17 18 19 20 C C A C A A D C C D 21 22 A B 1. int float long int 2. c = yc = y 3. % D % d 4. printf( % f, % d, a, x) ; printf( % f, % d, x, a) ; 5. int i = 0, j = 0, k = 0; 1. x = 2, y = 3 2. c = 1 1. m in( ) { loat x, y; 2. m in( ) scanf( % f, % f, &x, &y) ; printf( x + y = % f, x - y = % f\ n, x + y, x - y) ; printf( x* y = % f, xy = % f\ n, x* y, x / y) ; { loat f, c; scanf( % f, &f) ; c = 5. 0 /9* ( f - 32) ; 201
printf( wendu: % f \n, c) ; 3. include math. h { loat a, b, av, s1, s2; scanf( % f, % f, &a, &b) ; av = a* b; s1 = sqrt( a* a + b* b) ; s2 = 2 * ( a + b) ; printf( av = % f, s1 = % f, s2 = % f\ n, av, s1, s2) ; 4. include math. h { loat v0, q, s, g = 9. 8; scanf( % f, % f, &v0, &q) ; s = 2* v0 * v0* sin( q) * cos( q) / g; printf( s = % f\ n, s) ; 2 1 2 3 4 5 6 7 8 9 10 A A B C A C D B C C 11 12 13 14 15 16 D A B C A D 3 1 2 3 4 5 6 7 8 A D D D D B D B
3 4 1. 1, 0 2. > > = < < = = =! =, &&! 3. > > = < < = 4.! 5. * / % 6.! && 7. ( 1) 0, ( 2) 0, ( 3) 0, ( 4) 1 8. a < c b < c 9. a < 0&&b < 0 a < 0&&c < 0 b < 0&&c < 0 10. x < = 100&&x > = 0 x < - 100 11. a = = b&&b == c&&a = = c, a = = b b = = c a == c 12. ( 1 ) 1, ( 2 ) 0, ( 3 ) 1, ( 4 ) 1, ( 5 ) 1 13. 1 14. 1 15. switch 1 2 3 4 5 6 7 8 9 10 B A D A B C D C B D 11 12 13 14 15 16 17 18 A B A D B A C A 1. ( a > b) ( ; ) 2. if( a > b) { c = a; a = b; b = c; 203
1. a = 3 b = 2 c = 2 2. a = 2 b = 1 c = 2 3. z = - 1 4. x = 10 1. m in( ) { nt m; float n; printf( : ) ; scanf( % d, &m) ; if 2. m in( ) m < 0) printf( ) ; else if( m < 10) n = m* 2. 85; else if( m < 100 ) n = m* 2. 85 * ( 1-0. 05) ; else n = m* 2. 85* ( 1-0. 1) ; printf( % f\ n, n) ; { nt a, b, c, d, min; 3. m in( ) scanf( % d% d% d, &a, &b, &c) ; d = a < b? a: b; min = d < c? d: c; printf( % d \ n, min) ; { loat s; scanf( % f, &s) ; i ( s > 100) printf( ) ; e se if( s > = 80) printf( very good! ) ; e se if( s > = 60) printf( good! ) ; e se if( s > = 40) printf( fair ) ; else printf( pool ) ;
3 4. ain( ) { nt s; char ch; scanf( % d, &s) ; switch( s /10) { ase 10: case 9: ch = A ; break; case 8: ch = B; break; case 7: ch = C ; break; case 6: ch = D ; break; default: ch = E ; printf( grade is % c \n, ch) ; 5 1. 1, 0 2. 0 3. 2 4., 5. 6. a! = 0 7. c! = \ n, c > = 0 &&c < = 9 8. 1, 5 9. 2* x + 4* y = = 90 10. t = - t 11. break 1 2 3 4 5 6 7 8 9 10 D A D C B A D A B C 205
11 12 13 14 15 16 17 18( 1) 18( 2) D C C C C C A B C 1. 2 : for( i = 1; i < = 5; i + + ) s = s + i; 2. 1 : s = 1; 1. = 2 y = 3 x = 5 y = 8 x = 13 y = 21 x = 34 y = 55 2. i = 11 3. x = 10, y = 6 4. 7 4 5. * 1* * * * 3* * 6. 8, 20 7. 0 1 1 2 3 8. * #* #* # 9. * # 1. define N 5 m in( ) { nt a[ N] [ 2], m1 = 0, n2 = 0, i, j; for( i = 0; i < N; i + + ) { canf( % d% d, &a[ i] [ 0 ], &a[ i] [ 1] ) ;
3 : if( ( a[ i] [ 0] - 60 ) * ( a[ i] [ 1] - 60) < 0 ) m1 + + ; if( ( a[ i] [ 0] < 60 ) &&( a[ i] [ 1] < 60) ) n2 + + ; printf( = % d, = % d \ n, m1, n2) ; { nt n = 10, m1 = 0, n2 = 0, a, b, i; 2. ain( ) f r( i = 1; i < = n; i + + ) { canf( % d% d, &a, &b) ; if( ( a - 60) * ( b - 60) < 0) m1 + + ; if( ( a < 60) &&( b < 60) ) n2 + + ; printf( = % d, = % d \ n, m1, n2) ; { nt x, m = 0, n = 0, mv = 0, nv = 0; 3. ain( ) scanf( % d, &x) ; w ile( x! = 0) { i ( x > 0) { m + + ; mv + = x; else { n + + ; nv + = x; scanf( % d, &x) ; printf( % d, % d; % d, % d, m, mv /m, n, nv / n) ; { nt i; float s; 4. ain( ) f r( i = 5; i < = 150; i + = 5) { i ( i < = 50) s = i* 1. 5 ; else s = i* 1. 5 + ( i - 50) * 0. 6; printf( % d, % f\ n, i, s) ; { nt a[ 30] [ 6], i, j, s; f r( i = 0; i < 30 ; i + + ) { = 0 ; 207
f r( j = 0; j < 5 ; j + + ) { canf( % d, &a[ i] [ j] ) ; s + = a[ i] [ j] ; a[ i] [ 5] = s /5; printf( avreages = % d \ n, a[ i] [ 5 ] ) ; : ain( ) { nt a1, a2, a3, a4, a5, i, j, s; f r( i = 1; i < = 30; i + + ) { rintf( % d :, i) ; scanf( % d% d% d% d% d, &a1, &a2, &a3, &a4, &a5) ; s = ( a1 + a2 + a3 + a4 + a5) /5; printf( = % d \ n, s) ; 6 1. 20, a 2. 9, 0, 10, x 3. char str[ ] = { Lei ; 4. 5 5. 1 2 3 4 5 6 7 8 9 10 B B D D C C B D D C 11 12 13 14 15 16 17 18 19 20 C D B D C A B D D C
3 21 A 1. 2. 0, 3 i = 1 i = 0 1. s = 30 2. 5 9 45 8 42 3. 12 4. 10010 1. ain( ) { nt a[ 100 ], min, i, j, t; fo ( i = 0; i < = 99 ; i + + ) scanf( % d, &a[ i] ) ; j = 0; for i = 1; i < = 99; i + + ) if( a[ j] > a[ i] ) { j = i; i ( j! = 0) { t = a[ j] ; a[ j] = a[ 0] ; a[ 0] = t; 2. # efine N 6 printf( the new sort: ) ; f r( i = 0; i < = 99; i + + ) printf( % 5d, a[ i] ) ; { nt i; float a[ N], max, min, sum; fo ( i = 0; i < N; i + + ) 209
scanf( % f, &a[ i] ) ; sum = min = max = a[ 0] ; for i = 1; i < N; i + + ) { f( max < a[ i] ) max = a[ i] ; if( min > a[ i] ) min = a[ i] ; sum + = a[ i] ; sum = ( sum - max - min) / ( N - 2) ; printf( zuihou defen: %. 2f \n, sum) ; 3. include stdio. h define M 5 # efine N 6 { nt a[ M] [ N] ; int max, min, sum; int b[ M + 1] ; int i, j, t; for( i = 0; i < M; i + + ) { rintf( ( % d) hao defen wei:, i + 1) ; for( j = 0 ; j < N - 1; j + + ) scanf( % d, &a[ i] [ j] ) ; f r( i = 0; i < M; i + + ) { ax = min = a[ i] [ 0] ; sum = 0; f r( j = 0; j < N - 1; j + + ) { f( max < a[ i] [ j] ) max = a[ i] [ j] ; if( min > a[ i] [ j] ) min = a[ i] [ j] ; sum + = a[ i] [ j] ; a[ i] [ N - 1 ] = ( sum - max - min) / ( N - 3) ; printf( ( % d) hao zuihaopingfen = % d \ n, i + 1, a[ i] [ N - 1] ) ; for( i = 0; i < M; i + + ) { b[ i] = a[ i] [ N - 1 ] ; b[ M] = 0;
3 printf( \ nmingcipailie wei: \ n ) ; for( i = 0; i < M; i + + ) { ax = 0; for( j = 1 ; j < = M; j + + ) { if( b[ max] < b[ j] ) max = j; printf( ( % d) hao zongfenshi % d \ n, max + 1, b[ max] ) ; b[ max] = 0; 7 1., 2. 3. ( auto) 1 2 3 4 5 6 7 8 9 10 A C D D A D C D C C 11 12 13 14 C A D C 1. 5, 25 2. 8, 17 211
8 1 2 3 4 5 C A A B B 9 1 2 3 4 5 6 7 8 9 10 C C D A B C A A C B 11 12 13 14 15 16 17 18 19 20 B B D D A D D C C A 21 22 23 24 B B C A 10 1 2 3 4 5 6 7 8 9 A B D D B C A B C 11 1 2 3 4 5 6 7 8 9 10 B D D B B A D A D A 11 12 13 14 15 16 17 18 19 20 A A B B C A D D D A
3 21 22 23 24 25 26 27 28 29 C C C C A C A B B 1. a /( b* c) a / b /c 2. 1 3. rewind fseek 4. oid fun ( int * q) void fun ( int q[ ] ) void fun ( int q[ M] ) 5. 6354 6. + + w[ i - 1] 7. a, pb pa, pc pb, pc 12 1 2 3 4 5 6 7 8 9 10 A C B A C D C C B C 11 12 13 14 15 16 17 18 19 20 D C A A D A B D B D 13 1 2 3 4 5 6 7 8 9 10 C B D A B D C A D D 213
11 12 13 14 15 16 17 18 19 20 C A B B C D B D A C 1. 20, 0 2. 17 3. X 4. 3, 2 5. / i 6. 1000 10 7. 3, 5 8. 80 9. d1. dat, rb 10. * k 11. ax < a[ row] [ col] min > max 12. t * s - * t 14 1 2 3 4 5 6 7 8 9 10 C A B D B A D C A A 11 12 13 14 15 16 17 18 19 20 C B D A B D C D A B
3 21 22 23 24 25 26 27 28 29 30 C B D C C C C B A C 31 32 33 34 35 36 37 38 39 40 C A A A C D B D D A 1. - 3 2. i = 10, j = 20 3. 1 4. 5 0 3 5. 58 6. 7 7. 9 8. [ i] [ i] x[ i - 1 ] [ j - 1] + x[ i - 1] [ j] 9. ( s[ i] > = 0 &&s[ i] < = 9 ) \0 10. findbig 11. 16 12. x. link = y. link; 13. Hell 15 1 2 3 4 5 6 7 8 9 10 A C B D B D B D C B 11 12 13 14 15 16 17 18 19 20 A B B C B A A A C B 215
21 22 23 24 25 26 27 28 29 30 D D C D A B A A D D 31 32 33 34 35 D B D D A 1. x + = 1; 2. ( y% 2) = = 1 3. 52 4. 8921 5. 120 6. x 7. 0, 7 8. a[ i - 1 ], a[ 9 - i] 9. 9876 10. s[ i + + ] 11. struct STRU * 12. struct STRU 13. fopen