ebook 241-1

Size: px
Start display at page:

Download "ebook 241-1"

Transcription

1 C 1 C C C 1.1 hello, world C hello, world #include <stdio.h> main() printf("hello, world\n");

2 2 C U N I X. c h e l l o. cc hello.c a. o u t a. out a. o u t hello, world #include <stdio.h> main() main main printf("hello, world\n"); main printf \n C C F O RT R A N P a s c a l m a i n m a i m a i n m a i m a i n #include <stdio.h> C 7 B m a i n m a i n printf("hello, world\n"); "hello, world\n" p r i n t f p r i n t f "hello, world\n" p r i n t f C \ n \ n p r i n t f \ n \ printf("hello, world

3 1 3 "); C p r i n t f #include <stdio.h> main() printf("hello, "); printf("world"); printf("\n"); \ n \ n C \ t \ b \" \\ hello, world 1-2 p r i n t f \ c c 1.2 C = (5/9) ( F 3 2 )

4 4 C m a i n hello, world #include <stdio.h> /* fahr = 0, 20,..., 300 main() int fahr, celsius; int lower, upper, step; lower = 0; upper = 300 ; step = 20; /* /* /* fahr = lower; while (fahr <= upper) celsius = 5 * (fahr-32) / 9; printf("%d\t%d\n", fahr, celsius); fahr = fahr + step; /* fahr=0, 20,..., 300 /* * / C int fahr, celsius; int lower, upper, step; i n t f l o a i n t f l o a t i n ~ f l o a t i n t f l o a t C c h a r s h o r t

5 1 5 l o n g d o u b l e 4 lower = 0; upper = 300 ; step = 20; fahr = lower; w h i l e while (fahr <= upper)... w h i l e f a h r u p p e r f a h r u p p e r w h i l e while (i < j) i = 2 * i; w h i l e C celsius = 5 * (fahr-32) / 9; c e l s i u s / 9 C / p r i n t f p r i n t 7 %

6 6 C 2 3 % d printf("%d\t%d\n", fahr, celsius); f a h r c e l s i u s \ t p r i n t f 1 % 2 3 n p r i n t f C C p r i n t f C A N S I p r i n t f C s c a n f s c a n f p r i n t f p r i n t f 1 % d printf("%3d %6d\n", fahr, celsius); f a h r c e l s i u s f a h r 3 c e l s i u s F #include <stdio.h> /* fahr = 0, 20,..., 300 main() float fahr, celsius; int lower, upper, step; lower = 0; upper = 300 ; step = 20; /* /* /*

7 1 7 fahr = lower; while (fahr <= upper) celsius = (5.0 / 9.0) * (fahr-32.0); printf("%3.0f %6.1f\n", fahr, celsius); fahr = fahr + step; f a h r c e l s i u s f l o a t 5 / / 9. 0 fahr fahr = lower; while ( fahr <= upper ) i n t f l o a t p r i n t f % 3. 0 f f a h r 3 % 6. 1 f c e l s i u s % f % 6 f 6 %. 2 f % f % d % 6 d 6 % f % 6 f 6 %. 2 f % 6. 2 f 6 p r i n t f % o % x % c % s % %

8 8 C for # include <stdio.h> /* main( ) int fahr; for ( fahr = 0; fahr <= 300; fahr = fahr + 20 ) printf ( "%3d # %6.1f\n", fahr, (5.0 / 9.0) * (fahr - 32 ) ); f a h r i n t f o r p r i n t f 3 p r i n t f 3 % 6. 1 f f o r w h i l e w h i l fahr = 0 fahr <= 300 p r i n t f fahr = fahr + 20 w h i l e f o r w h i l e f o r f o r f o r w h i l e

9 # d e f i n e #define # d e f i n e #include <stdio.h> #define LOWER 0 /* #define UPPER 300 /* #define STEP 20 /* /* - main ( ) int fahr; for ( fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP ) printf ( "%3d %6.1f\n", fahr, (5.0 / 9.0) * (fahr - 32 ) ); L O W E R U P P E R S T E P # d e f i n e C g e t c h a r p u t c h a r g e t c h a r c = getchar () c

10 10 C 7 p u t c h a r putchar ( c ) c p u t c h a r p r i n t f g e t c h a r p u t c h a r while C #include <stdio.h> /* 1 main ( ) int c; c = getchar ( ); while ( c!= EOF ) putchar ( c ); c = getchar ( );! = c h a r i n t C g e t c h a r E O F end of file c g e t c h a r c c h a r c E O F c i n t E O F < s t d i o. h > c h a r E O F C

11 1 11 c = getchar ( ) = c w h i l e #include <stdio.h> /* 2 main ( ) int c; while ( (c = getchar ( ) )!= EOF ) putchar ( c ); w h i l e c w h i l e w h i l e w h i l m a i n g e t c h a r w h i l e! = =! c = getchar ( )!= EOF c = ( getchar ( )!= EOF ) c 0 1 g e t c h a r getchar ( )!= EOF E O F #include <stdio.h> /* 1 main ( ) long nc;

12 12 C nc = 0; while ( getchar ( )!= EOF ) ++nc; printf("%ld\n", nc); ++nc; nc = nc + 1; + + n c n c n c n c n c + + n c 1 i n t l o n g l o n ( ) 32 i n t l o n g i n t i n t % l d p r i n t f l o n g d o u b l e ( ) w h i l e f o r #include <stdio.h> /* 2 main ( ) double nc; for ( nc = 0; getchar ( )!= EOF; ++nc ) ; printf("%.0f\n", nc); % f f l o a t d o u b l e %. 0 f 0 f o r C f o r f o r w h i l e f o r g e t c h a r 0 w h i l e f o r 0 w h i l e f o r

13 #include <stdio.h> /* main ( ) long c, nl; nl = 0; while ( (c = getchar ( ) )!= EOF ) if ( c =='\n' ) ++nl; printf("%d\n", nl); w h i l e i f i f + + n l i f = = C P a s c a l = F O RT R N. E Q. C = = C = = = 2 'A' A S C I I 65 A 65 ' A ' 65 ' A ' '\n' A S C I I 10 '\ n ' "\ n " \ t \ b \\ 1.5.4

14 14 C U N I X w c #include <stdio.h> #define IN 1 /* #define OUT 0 /* /* main ( ) int c, nl, nw, nc, state; state = OUT; nl = nw = nc = 0; while ( (c = getchar ( ) )!= EOF ) ++nc; if ( c =='\n' ) ++nl; if ( c == ' ' c == '\n' c == '\t' ) state = OUT; else if ( state == OUT ) state = IN; ++nw; printf("%d %d %d\n", nl, nw, nc); s t a t e O U T I N O U T 1 0 nl = nw = nc = 0; n l nw n c 0 nl = ( nw = ( nc = 0 )); O R if ( c == ' ' c == '\n' c == '\t' ) c c c \ t

15 1 15 && A N D && c e l s e i f if ( ) else 1 2 i f - e l s e 1 2 e l s e i f i f C 12 1 #include <stdio.h> /* main ( ) int c, i, nwhite, nother; int ndigit[10]; nwhite = nother = 0; for ( i =0; i < 10; ++i ) ndigit[i] = 0; while ( ( c = getchar() )!= EOF ) if ( c >= '0' && c <= '9' ) ++ndigit[c - '0']; else if ( c == ' ' c == '\n' c == '\t' ) ++nwhite; else

16 16 C ++nother; printf( "digits =" ); for ( i =0; i < 10; ++i ) printf( " %d", ndigit[i] ); printf( ", white space = %d, other = %d/n", nwhite, nother); digits = , white space = 123, other = 345 int ndigit[10]; n d i g i t 10 C 0 10 n d i g i t [ 0 ] n d i g i t [ 1 ] n d i g i t [ 9 ] f o r i if ( c >= '0' && c <= '9' )... c c - '0' ' 0 ' ' 1 ' ' 9 ' c h a r c h a r i n t c - '0' c ' 0 ' ' 9 ' 0 9 n d i g i t if ( c >= '0' && c <= '9' ) ++ndigit[c - '0']; else if ( c == ' ' c == '\n' c == '\t' ) ++nwhite; else ++nother; if ( ) 1 1 else if ( ) 2 2 else n

17 1 17 i f e l s e e l s e i f i f e l s e 0 else if ( ) i f e l s e 3 s w i t c h 3. 4 s w i t c h C F O RT R A N P a s c a l C p r i n t f g e t c h a r p u t c h a r C F O RT R A N ** power(m, n) power(m, n) m n p o w e r ( 2, 5 ) 32 x y pow(x, y) power(m, n) #include <stdio.h> int power(int m, int n); /* power main ( ) int i; for ( i =0; i < 10; ++i )

18 18 C printf("%d %d %d\n", i, power(2, i), power(-3, i)); return 0; /* power: n n >=0 int power(int base, int n) int i, p; p = 1; for ( i = 1; i <= n; ++i ) p = p * base; return p; C m a i n p o w e r printf("%d %d %d\n", i, power(2, i), power(-3, i)); p o w e r p o w e r power(2, i) i 4 p o w e r int power(int base, int n) p o w e r p o w e r i p p o w e r i m a i n i p o w e r r e t u r n m a i n r e t u r n return r e t u r n

19 1 19 m a i n r e t u r n m a i n 0 0 m a i n r e t u r n m a i n r e t u r n m a i n int power(int m, int n); p o w e r i n t i n t p o w e r int power(int, int); ANSI C C C p o w e r /* power: n n >=0 /* power(base, n) int base, n; int i, p; p = 1; for ( i = 1; i <= n; ++i ) p = p * base; return p; i n t ANSI C p o w e r int power( ); p o w e r p o w e r i n t ANSI C

20 20 C F O RT R A N C C F O RT R A N P a s c a l v a r C p o w e r /* power: n n >=0 2 int power(int base, int n) int p; for ( n = 1; n > 0; --n ) p = p * base; return p; n f o r 0 i p o w e r n p o w e r C while ( ) if ( )

21 1 21 g e t l i n e g e t l i n e c o p y m a i n g e t l i n e c o p y #include <stdio.h> #define MAXLINE 1000 /* int getline (char line[ ], int maxline ); void copy ( char to[ ], char from [] ); /* main ( ) int len; /* int max; /* char line[maxline]; /* char longest[maxline]; /* max = 0; while ( ( len = getline (line, MAXLINE) ) > 0 ) if (len > max) max = len; copy ( longest, line ); if (max > 0) /* printf ("%s", longest ) ; return 0 ; /* getline s int getline (char s [ ], int lim) int c, i; for (i = 0; i < lim -1 && (c = getchar ( ) )!= EOF && c!= '\n'; ++i ) s[i] = c;

22 22 C if (c == '\n' ) s[i] = c; ++i; s[i] = '\0'; return i; /* copy from to; to void copy ( char to [ ], char from [ ]) int i; i = 0; while ( ( to[ i ] = from [ i ])!= '\0') ++i; g e t l i n e c o p y m a i n g e t l i n e g e t l i n int getline (char s [ ], int lim) s l i m g e t l i n e s m a i n p o w e r g e t l i n e r e t u r n g e t l i n e i n t i n t c o p y c o p y v o i d g e t l i n e '\ 0 ' 0 C C "hello\n" '\0' h e l l o \n \0 p r i n t f % s c o p y '\0' '\0' m a i n g e t l i n e m a i n

23 1 23 g e t l i n e g e t l i n c o p y 1-16 m a i n reverse ( s ) s 1.10 m a i n l i n e l o n g e s t m a i n m a i m a i n g e t l i n e i c o p y i 4 F O RT R A N C O M M O N P a s c a l e x t e r n l i n e l o n g e s t m a x #include <stdio.h> #define MAXLINE 1000 /* int max; /* char line[maxline]; /*

24 24 C char longest[maxline]; /* int getline (void ); void copy ( void ); /* main ( ) int len; extern int max; extern char longest[ ]; max = 0; while ( ( len = getline ( ) ) > 0 ) if (len > max) max = len; copy ( ); if (max > 0) /* printf ("%s", longest ) ; return 0 ; /* getline int getline (void ) int c, i; extern char line[ ]; for (i = 0; i < MAXLINE -1 && (c = getchar ( ) )!= EOF && c!= '\n'; ++i ) line[i] = c; if (c == '\n' ) line[i] = c; ++i; line[i] = '\0'; return i; /* copy void copy ( void ) int i; extern char line[ ], longest[ ]; i = 0; while ( ( longest[ i ] = line [ i ])!= '\0')

25 i; m a i n g e t l i n e c o p y e x t e r n e x t e r n e x t e r n e x t e r n m a i n g e t l i n e c o p y e x t e r n e x t e r n f i l e 1 f i l e 2 f i l e 3 f i l e 2 f i l e 3 e x t e r n e x t e r # i n c l u d e.h < s t d i o. h > 4 7 B g e t l i n e c o p y getline( ) copy( ) C C v o i d C 1-20 d e t a b n 1-21 e n t a b

26 26 C d e t a b 1-22 n 1-23 C C 1-24 C

27 C 2 ANSI C s i g n e d u n s i g n e d long double c o n s t x X ANSI C 6 i f e l s e i n t f l o a t 2.2 C

28 28 C c h a r i n t f l o a t d o u b l e s h o r t l o n g short int sh; long int counter; i n t s h o r t l o n g i n t s h o r 16 l o n g 32 s h o r t i n t 16 l o n g 32 s h o r t i n i n t l o n g s i g n e d u n s i g n e d c h a r u n s i g n e d 0 2 n n c h a r 8 unsigned char 0 ~ 255 signed char 128 ~ 127 c h a r long double float double long double < l i m i t s. h > < f l o a t. h > B 2-1 s i g n e d u n s i g n e d c h a r s h o r t i n t l o n g i n t l o n g l L L i n t l o n g u U u l U L unsigned long e 2 d o u b l e f F f l o a t l L long double 0 0 x 0 X x 1 f 0 X 1 F l L l o n g u U u n s i g n e d 0 X F U L unsigned long 15

29 2 29 ' x ' A S C I I '0' 48 0 '0' 48 \ n '\ooo' o o o 1 ~ '\xhh' h h 0 9 a f A F #define VTAB '\013' #define BELL '\007' #define VTAB '\xb' #define BELL '\x7' /* ASCII /* ASCII /* ASCII /* ASCII \a \\ \b \? \f \' \n \" \r \ooo \t \xhh \v '\0' 0 '\0' 0 0 #define MAXLINE 1000 char line[maxline+1]; #define LEAP 1 /* int days[31+28+leap ]; 0 "I am a string" "" /* \" "hello," " world"

30 30 C "hello, world" '\0' C strlen(s) s '\ 0 ' /* strlen s int strlen(char s[]) int i; i = 0; while (s[i]!= '\0') ++i; return i; s t r l e n < s t r i n g. h > ' x ' " x " x '\ 0 ' enum boolean NO, YES ; e n u m 0 1 enum escapes BELL = '\a', BACKSPACE = '\b', TAB = '\t', NEWLINE = '\n', VTAB = '\v', RETURN = '\r' ; enum months JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC ; /* FEB 2 MAR 3 # d e f i n e e n u m # d e f i n e 2.4

31 2 31 int lower, upper, step; char c, line [1000]; int lower int upper; int step; char c; char line [1000]; char esc = '\\'; int i = 0; int limit =MAXLINE+1; float eps = 1.0e-5; 0 c o n s t c o n s t const double e = ; const char msg [ ] = "warning:"; c o n s t int strlen(const char[]); c o n s t * / % x % y x y x x % y if ( (year % 4 == 0 && year % 100!= 0) year % 400 == 0 ) printf( "%d is a leap year\n", year ); else printf("%d is not a leap year\n", year );

32 32 C % f l o a t d o u b l e * / % > >= < <= ==!= i < lim -1 i < (lim - 1) && && C g e t l i n e for ( i = 0; i < lim -1 &&(c = getchar())!= '\n' && c!= EOF; ++i ) s[i] = c; s i < lim 1 i < lim g e t c h a r c E O F c && i < lim - 1 && (c = getchar())!= '\n' && c!= EOF! = (c = getchar())!= '\n' c '\n' 1 0! 0 0 1

33 2 33 if (!valid ) if ( valid == 0 )! v a l i d 2-2 && f o r 2.7 f + i i f l o a t c h a r c h a a t o i /* atoi s int atoi( char s[]) int i, n; n = 0; for ( i = 0; s[i] >= '0' && s[i] <= '9'; ++i ) n = 10 * n + (s[i] - '0'); return n; s[i] - '0' s [ i ] ' 0 ' ' 1 ' '2' l o w e r A S C I I l o w e r /* lower c ASCII int lower (int c) if (c >= 'A' && c<= 'Z' ) return c + 'a' - 'A'; else

34 34 C return c; A S C I I A S C I I A Z E B C D I C E B C D I C B < c t y p e. h > t o l o w e r ( c ) c t o l o w e r l o w e r c >= '0' && c<= '9' isdigit(c) < c t y p e. h > C c h a r c h a r i n t 1 0 C c h a r s i g n e d u n s i g n e d i > j && 1 0 d = c >= '0' && c <= '9' c d 1 d 0 i s d i g i t 0 i f w h i l e f o r 0 + * A. 6 long double long d o u b l e d o u b l f l o a t f l o a c h a r s h o r t i n l o n g l o n

35 2 35 f l o a t d o u b l e < m a t h. h > f l o a t u n s i g n e d i n t 16 l o n g 32 1L < 1U i n t 1 U signed long 1L > 1UL 1 L unsigned long = int i; char c; i = c; c = i; c x f l o a t i i n t x = i i = x, f l o a t i n t d o u b l e f l o a t c h a r s h o r t i n f l o a t d o u b l e c h a r f l o a t i n t d o u b l e s q r t d o u b l e s q r t < m a t h. h > n sqrt ( (double) n)

36 36 C n s q r t n d o u b l e n n s q r t double sqrt(double); root = sqrt(2); d o u b l e 2. 0 r a n d s r a n d unsigned long int next = 1; /* rand 0~32767 int rand(void) next = next * ; return (unsigned int)(next/65536) % 32768; /* srand rand() void srand(unsigned int seed) next = seed; 2-3 h t o i ( s ) 0 x 0 X 0 ~ 9 a ~ f A ~ F 2.8 C if (c == '\n') ++nl; n n + + n 1 ++n n n 1

37 2 37 n++ n n n n + + n x = n++ x 5 x = ++n x n (i + j)++ 1 if (c == '\n') nl++; + + s q u e e z e ( s, c ) s c /* squeeze s c void squeeze(char s[], int c) int i, j; for (i = j = 0; s[i]!= '\0'; i++) if (s[i]!= c) s[j++] = s[i]; s[j] = '\0'; c j 1 i f if (s[i]!= c) s[j] = s[i]; j++; g e t l i n e i f if (c == '\n') s[i] = c; ++i; i f if (c == '\n') s[i++] = c;

38 38 C s t r c a t ( s, t ) t s s t r c a t s /* strcat t s s void strcat(char s[], char t[]) int i, j; i = j = 0; while (s[i]!= '\0') /* s i++; while ( (s[i++] = t[j++])!= '\0') /* t ; t s ++ i j 2-4 s q u e e z e ( s 1, s 2 ) s 1 s a n y ( s 1, s 2 ) s 2 s 1 s 1 s 2 1 s t r p b r k 2.9 C c h a r s h o r t i n t l o n g & AND OR ^ XOR << >> ~ & n = n & 0177; n 7 0 x = x SET_ON; x S E T _ O N 1 ^ 1 0 & &&

39 2 39 x 1 y 2 x & y 0 x && y 1 < < > > x << 2 x ~ x = x & ~ 077 x 0 x & ~ 077 x & x 1 6 ~ 077 getbits(x, p, n) x p n 0 n p getbits(x, 4, 3) /* getbits p n unsigned getbits(unsigned x, int p, int n) return (x >> (p+1-n) ) & ~ ( ~ 0 << n); x >> (p+1 n) ~ 0 1 ~ 0 << n ~ 0 n 0 n setbits(x, p, n, y) x p n y n 2-7 invert(x, p, n) x p n rightrot (x, n) x n 2.10 i = i +2 i += 2 + = = * = / = % = > > = < < = & = ^ =! = =

40 40 C += o p= o p + - * / % << >> & ^ op, = 2 = ( ) op ( ) x *= y + 1 x = x * (y + 1) x = x * y + 1 b i t c o u n t 1 /* bitcount x 1 int bitcount (unsigned x ) int b; for ( b = 0; x!= 0; x >>= 1) if ( x & 01 ) b++; return b; x x 0 2 i 2 i 2 i i += 2 i = i + 2 yyval [ yypv [ p3 + p4 ] + yypv [ p1 + p2 ] ] += 2 ANSI C

41 2 41 while ( ( c = getchar( ) )!= EOF) + = = 2-9 x &= ( x 1 ) x 1 b i t c o u n t if (a > b) z = a; else z = b; a b z? :? : z = (a > b)? a : b; /* z = max(a, b) 2 3 f f l o a t n i n t (n > 0)? f : n f l o a t n?: n 10 for (i = 0; i<n; i++) printf("%6d%c", a[i], (i % 10 == 9 i == n - 1)? '\n' : ' '); 10 n i f - e l s e printf("you have %d item%s.\n", n, n == 1? "" : "s"); 2-10 l o w e r i f -

42 42 C e l s e * / % + ( ) >. 6 s i z e o f 5 * & 3, 2-1 ( ) [ ] >.! ~ ++ + * & ( ) sizeof * / % + << >> < <= > >= ==!= & ^ & &? : = += = *= /= %= &= ^= = <<= >>=, + * & ^ ==!= if ( (x & MASK) == 0) C &&? : x = f( ) + g( ); f( ) g( ) g( ) f g x printf("%d %d\n", ++n, power(2,n) ); /*

43 2 43 n p o w e r ++n; printf("%d %d\n", n, power(2,n) ); a[i] = i++; i C p r i n t f

44 C x =0 i + + printf (...) ; x = 0; i++; printf( ); C P a s c a l i f e l s e w h i l e f o r if-else i f - e l s e if ( ) 1 else 2 e l s e i f e l s e 2 i f

45 3 45 if ( ) if (!= 0 ) i f - e l s e e l s e i f e l s e e l s e e l s i f if ( n > 0 ) if ( a > b ) z = a; else z = b; e l s e i f e l s e i f if ( n > 0 ) if ( a > b ) z = a; else z = b; if ( n >= 0 ) for ( i = 0; i < n; i++ ) if ( s[i] > 0) printf ( " " ); return i; else /* printf ( "error -- n is negative\n" ); e l s e i f i if ( a > b ) z = a; else z = b; z = a i f z = a 3.3 else-if C

46 46 C if ( ) else if ( ) else if ( ) else if ( ) else i f e l s e else v x v x x v 0 ~ n 1 x v x x /* binsearch v[0]<=v[1]<=v[2]<= <=v[n-1] x int binsearch ( int x, int v[ ], int n ) int low, high, mid; low = 0; high = n - 1; while ( low <= high ) mid = ( low + high ) / 2; if ( x < v[mid] ) high = mid - 1; else if ( x > v[mid] ) low = mid + 1; else /* return mid; return -1; /*

47 3 47 x v [ m i d ] e l s e - i f 3-1 w h i l e 3.4 switch s w i t c h switch ( ) case : case : default: d e f a u l t d e f a u l t d e f a u l t s w i t c h d e f a u l t 1 i f else if e l s e s w i t c h #include <stdio.h> main ( ) /* int c, i, nwhite, nother, ndigit[10]; nwhite = nother = 0; for ( i = 0; i < 10, i++ ) ndigit[i] = 0; while ( ( c = getchar ( ) )!= EOF ) switch ( c ) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ndigit[c - '0']++; break; case ' ': case '\n': case '\t': nwhite++; break; default: nother++; break;

48 48 C printf ( "digits = " ); for ( i = 0; i < 10, i++ ) printf ( " %d", ndigit[i] ); printf ( ", white space = %d, other = %d\n", nwhite, nother ); return 0; b r e a k s w i t c h s w i t c c a s e c a s e c a s s w i t c h b r e a k r e t u r n b r e a k w h i l e f o r d o b r e a k s w i t c h d e f a u l t b r e a k s w i t c h 3-2 escape (s, t) t s \ n \ t s w i t c h 3.5 while f o r w h i l e f o r w h i l e while ( ) 0 f o r for ( ; ; ) while ( ) 2 3 c o n t i n e 3. 7

49 3 49 f o r w h i l e 1 3 f o r 2 2 for ( ; ; ) b r e a k r e t u r n w h i l e f o r while ( ( c = getchar ( ) ) == ' ' c == '\n' c == '\t' ) ; /* w h i l e f o r for ( i = 0; i < n; i++ ) C n F O RT R A N D O P a s c a l f o r C i f o r f o r f o r a t o i 2 4 a t o f #include <ctype.h> /* atoi s 2 int atoi ( char s[ ]) int i, n, sign;

50 50 C for ( i = 0; isspace ( s[i] ); i++ ) ; sign = ( s[i] == '-' )? -1 : 1; if (s[i] == '+' s[i] == '-' ) i++; for ( n = 0; isdigit ( s[i] ); i++) n = 10 * n + (s[i] - '0' ); return sign * n; /* /* s t r t o l B. 5 S h e l l D. L. Shell /* shellsort v[0] v[1] v[n-1] void shellsort ( int v[ ], int n ) int gap, i, j, temp; for ( gap = n/2; gap > 0; gap /= 2 ) for ( i = gap; i < n; i++ ) for ( j = i-gap; j >= 0 && v[j] > v[j+gap]; j -= gap ) temp = v[j]; v[j] = v[j+gap]; v[j+gap] = temp; f o r f o r n / 2 0 f o r f o g a p g a 1 f o r C, f o r f o r reverse ( s ) s #include <string.h> /* reverse s void reverse ( char s[ ] ) int c, i, j;

51 3 51 for ( i = 0, j =strlen(s) - 1; i < j; i++, j-- ) c = s[i]; s[i] = s[j]; s[j] = c; r e v e r s e f o r r e v e r s e for ( i = 0, j =strlen(s) - 1; i < j; i++, j-- ) c = s[i], s[i] = s[j], s[j] = c; 3-3 expand(s1, s2) s 1 a z s 2 a b c x y z a - b - c a - z a - z 3.6 do-while 1 w h i l e f o r C d o - w h i l e d o - w h i l e do while ( ) d o - w h i l e d o - w h i l e P a s c a l r e p e a t - u n t i l d o - w h i l e w h i l f o r d o - w h i l e i t o a i t o a a t o i /* itoa n s void itoa ( int n, char s[ ] ); int i, sign; if ( ( sign = n ) < 0 ) n = -n; i = 0; /* /* n

52 52 C do s[i++] = n % 10 + '0'; /* /* while ( (n /= 10) > 0); /* if (sign < 0) s[i++] = '-'; s[i] = '\0'; reverse(s); n 0 s d o - w h i l e d o - w h i l e d o - w h i l w h i l e 3-4 i t o a n ( 2 1 ) 3-5 itob(n, s, b) n b c itob(n, s, 16) n s 3-6 i t o a 3.7 break c o n t i n u e b r e a k f o r w h i l e d o - w h i l e s w i t c h b r e a k s w i t c h t r i m b r e a k /* trim int trim(char s[]); int n; for (n = strlen(s)-1; n >= 0; n--) if (s[n]!= ' ' && s[n]!= '\t' && s[n]!= '\n') break; s[n+1] = '\n'; return n; s t r l e n f o r n

53 3 53 c o n t i n u e b r e a k c o n t i n u e f o r w h i l e d o - w h i l e w h i l e d o - w h i l e c o n t i n u e f o r c o n t i n u e c o n t i n u s w i t c h c o n t i n u e s w i t c h c o n t i n u e a for (i =0; i < n; i++) if (a[i] < 0) /* continue; /* c o n t i n u e c o n t i n u e 3.8 goto C g o t o g o t o g o t o g o t g o t o b r e a k g o t o for ( ) for ( ) error: if (disaster) goto error; g o t o a b for (i = 0; i < n; i++) for (j = 0; j < m; j++) if (a[i] == b[j])

54 54 C goto found; /* found: /* a[i] ==b[j] g o t o g o t found = 0; for (i = 0; i < n &&!found; i++) for (j = 0; j < m &&!found; j++) if (a[i] == b[j]) found = 1; if (found) /* a[i-1] ==b[j-1] else /* g o t o g o t g o t o

55 C 4 C ANSI C C 1 C ANSI C ANSI C C 4.1 U N I X g r e p o u l d Ah Love! could you and I with Fate conspire To grasp this sorry Scheme of Things entire, Would not we shatter it to bits -- and then Re-mould it nearer to the Heart's Desire! Ah Love! could you and I with Fate conspire Would not we shatter it to bits -- and then Re-mould it nearer to the Heart's Desire!

56 56 C while ( ) if ( ) m a i n g e t l i n e 1 p r i n t f strindex(s, t) t s s t 1 C s t r i n d e x s t r s t r s t r i n d e x 5 g e t l i n e 1 #include <stdio.h> #define MAXLINE 100 /* int getline (char line[ ], int max); int strindex(char source[ ], char searchfor[ ]); char pattern[] = "ould"; /* /* main ( ) char line[maxline]; int found = 0; while ( getline(line, MAXLINE) > 0 ) if ( strindex(line, pattern) >= 0 ) printf( "%s", line); found++; return found; /* getline s int getline(char s[ ], int lim)

57 4 57 int c, i; i = 0; while ( -- lim > 0&& ( c = getchar() )!= EOF && c!= '\n' ) s[i++] = c; if (c == '\n' ) s[i++] = c; s[i] = '\0'; return i; /* strindex t s -1 int strindex(char s[], char t[] ) int i, j, k; for ( i = 0; s[i]!= '\0'; i++ ) for ( j =i, k = 0; t[k]!= '\0' && s[j] ==t[k]; j++, k++ ) ; if ( k > 0 && t[k] == '\0' ) return i; return -1; dummy( ) i n t r e t u r n r e t u r return r e t u r n r e t u r

58 58 C m a i n C U N I X 1 c c m a i n. c g e t l i n e. c s t r i n d e x. c cc main.c getline.c strindex.c m a i n. o g e t l i n e. o s t r i n d e x. o a. o u t m a i n. c cc main.c getline.o strindex.o m a i n. c g e t l i n e. o s t r i n d e x. o c c. c. o 4-1 strrindex(s, t) t s t v o i d i n t s q r t s i n c o s d o u b l e a t o f ( s ) s a t o f a t o i 2 3 a t o i a t o f a t o f < s t d l i b. h > a t o f i n t #include <ctype.h> /* s double atof( char s[ ]) double val, power; int i, sign; for ( i = 0; isspace(s[i]); i++ ) ; sign = (s[i] == '-' )? -1 : 1; /*

59 4 59 if ( s[i] == '+' s[i] == '-' ) i++; for (val = 0.0; isdigit(s[i]); i++) val = 10.0 * val +(s[i] -'0' ); if (s [i] ] = = '.') i++; for ( power = 1.0; isdigit(s[i]); i++) val = 10.0 * val +(s[i] -'0' ); power *= 10.0; return sign * val / power; a t o f a t o f #include <stdio.h> #define MAXLINE 100 /* main ( ) double sum, atof ( char [ ] ); char line[maxline]; int getline(char line[], int max); sum =0; while ( getline(line, MAXLINE) > 0 ) printf( "\t%g\n", sum += atof(line) ); return 0; double sum, atof ( char [ ] ); sum double atof char[ ] double a t o f a t o f m a i n a t o f a t o f d o u b l e m a i n i n t sum += atof(line) i n t

60 60 C double atof ( ); a t o f C v o i d a t o f a t o i /* atoi atof s int atoi( char s[ ] ) double atof(char s[ ]); return (int) atof ( s ); r e t u r n r e t u r return a t o f a t o i r e t u r n return atof ( s ); 4-2 a t o f e-6 e E 4.3 C e x t e r n a l i n t e r n a l i n t e r n a l C F O RT R A N C O M M O N P a s c a l

61 * / F o r t h P o s t s c r i p t (1-2) * (4 + 5) * while ( ) if ( ) else if ( ) else if ( ) else

62 62 C m a i n m a i n p u s h p o p m a i n #include #define main main() push pop void push ( double f ) double pop(void) int getop(char s[ ]) getop m a i n s w i t c h s w i t c h 3. 4 #include <stdio.h> #include <stdlib.h> /* atof() #define MAXOP 100 /* #define NUMBER '0' /* int getop ( char [ ] ); void push ( double f ); double pop(void); /* main ( ) int type; double op2; char s[maxop]; while ( ( type = getop(s) )!= EOF ) switch ( type ) case NUMBER: push(atof(s)); break;

63 4 63 case '+': push ( pop() + pop()); break; case '*': push ( pop() * pop()); break; case '-': op2 = pop( ); push ( pop() - op2); break; case '/': op2 = pop( ); if ( op2!= 0 ) push ( pop() / op2 ); else printf ( "error: zero divisor\n" ); break; case '\n': printf ( "\t%.8g\n", pop( ) ); break; default: printf ( "error: unknown command %s\n", s); break; return 0; + * / push ( pop() - pop() ); /* p o p m a i n #define MAXVAL 100 /* val int sp = 0; double val[maxval]; /* /* /* push f void push ( double f ) if ( sp < MAXVAL ) val[sp++] = f; else printf ( "error: stack full, can't push %g\n", f);

64 64 C /* pop double pop(void); if ( sp > 0 ) return val[--sp]; else printf ( "error: stack empty\n" ); return 0.0; p u s h p o p m a i n g e t o p N U M B E R #include <ctype.h> int getch(void); void ungetch(int); /* getop int getop(char s[ ] ) int i, c; while ( (s[0] = c = getch() ) == ' ' c == '\t' ) ; s[1] = '\0'; if (!isdigit( c ) && c!= '.' ) return c; /* i = 0; if ( isdigit( c ) ) /* while ( isdigit(s[++i] = c = getch( ) ) ) ; if (c == '.' ) /* while ( isdigit(s[++i] = c = getch( ) ) ) ; s[i] = '\0'; if (c!= EOF ) ungetch( c ); return NUMBER; g e t c h u n g e t c h

65 4 65 g e t c h u n g e t c h g e t c u n g e t c h u n g e t c h g e t c h g e t c h a r g e t c h u n g e t c h g e t c h u n g e t c h #define BUFSIZE 100 char buf[bufsize]; int bufp = 0; /* unget /* buf int getch(void) /* return ( bufp > 0 )? buf[--bufp] : getchar( ); void ungetch(int c) /* if ( bufp >= BUFSIZE ) printf ( "ungetch: too many characters\n" ); else buf[bufp++] = c; u n g e t c % s i n e x p p o w B. 4 < m a t h. h >

66 66 C 4-7 u n g e t s ( s ) u n g e t s b u f b u f p u n g e t c h 4-8 g e t c h u n g e t c h 4-9 g e t c h u n g e t c h E O F E O 4-10 g e t l i n e g e t c h u n g e t s 4.4 C m a i n s p v a l p u s h p o p main( ) int sp = 0; double val[maxval]; void push( double f ) double pop( void ) p u s h p o p s p v a l m a i n p u s h p o p m a i n e x t e r n

67 4 67 int sp; double val[maxval]; s p v a l extern int sp; extern double val[maxval]; s p i n t v a l d o u b l e e x t e r n e x t e r e x t e r n p u s h p o p v a l s p file1 extern int sp; extern double val [ ]; void push( double f ) double pop( void ) file2 int sp = 0; double val[maxval]; f i l e 1 e x t e r n f i l e 1 s p v a l 4.5 m a i n m a i n. c p u s h p o p s t a c k. c g e t o p g e t o p. c g e t c h u n g e t c h g e t c h. c c a l c. h # i n c l u d e # i n c l u d e calc.h

68 68 C #define NUMBER '0' void push( double ); double pop( void ); int getop( char [ ] ); int getch( void); void ungetch( int ); main.c #include <stdio.h> #include <stdlib.h> #include "calc.h" #define MAXOP 100 main( ) getop.c #include <stdio.h> #include <ctype.h> #include "calc.h" getop( ) getch.c #include <stdio.h> #define BUFSIZE 100 char buf[bufsize]; int bufp = 0; int getch( void ) void ungetch( int) stack.c #include <stdio.h> #include "calc.h" #define MAXVAL 100 int sp = 0;

69 4 69 double val[maxval]; void push( double ) double pop( void) 4.6 s t a c k. c s p v a l g e t c h. c buf b u f p s t a t i c s t a t i c b u f b u f p g e t c h - u n g e t c h g e t c h u n g e t c g e t c h u n g e t c h s t a t i c static char buf[bufsize]; static int bufp = 0; /* ungetch /* buf int getch( void ) void ungetch( int c) b u f b u f p s p v a l p u s h p o p s t a t i c s t a t i c

70 70 C 4-11 g e t o p u n g e t c h 4.7 r e g i s t e r r e g i s t e r register int x; register char c; f( register unsigned m, register long n ) register int i; C P a s c a l if ( n > 0 ) int i; /* i for ( i = 0; i < n; i++ ) i i f i int x;

71 4 71 int y; f ( double x ) double y; f x d o u b l e f i n t y int x = 1; char squote = '\''; long day = 1000L * 60L *60L * 24L; /* 3. 3 int binsearch( int x, int v[ ], int n ) int low = 0; int high = n - 1; int mid; int low, high, mid; low = 0; high = n - 1;

72 72 C d a y s int days[ ] = 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ; 12 0 char pattern [] = "ould"; char pattern [] = 'o', 'u', 'l', 'd', '\0' ; 5 4 '\ 0 ' 4.10 C 3. 6 i t o a p r i n t d #include <stdio.h> /* printd n void printd(int n ) if ( n < 0 ) putchar( '-' ); n = -n; if ( n / 10 ) printd( n / 10 ); putchar( n % 10 + '0' );

73 4 73 printd (123) p r i n t d n = p r i n t d 1 p r i n t d p r i n t C. A. R. Hoare /* qsort v[left] v[right] void qsort( int v[], int left, int right ) int i, last; void swap( int v[], int i, int j ); if ( left >= right ) return; swap( v, left, (left + right)/2 ); last = left; for ( i = left+1; i <= right; i++ ) if ( v[i] < v[left] ) swap( v, ++last, i ); swap( v, left, right ); qsort( v, left, last-1 ); qsort( v, last+1, right ); /* /* v[0] /* /* s w a p q s o r t /* swap v[i] v[j] void swap( int v[], int i, int j ) int temp; temp = v[i]; v[i] = v[j]; v[j] = temp; q s o r t

74 74 C p r i n t d i t o a 4-13 reverse( s ) s C C # i n c l u d e # d e f i n e # i n c l u d e # d e f i n #include " " #include < > < > # i n c l u d e # i n c l u d e # d e f i n e e x t e r n < s t d i o. h > # i n c l u d e # d e f i n e #define # d e f i n e # d e f i n e \ # d e f i n e Y E S printf ( "YES" ) Y E S M A N

75 4 75 #define forever for ( ; ; ) /* f o r e v e r #define max( A, B ) ( ( A ) > ( B )? ( A ) : ( B ) ) m a x m a x A B x = max( p+q, r+s ); x = ( ( p+q ) > ( r+s )? ( p+q ) : ( r+s ) ); m a x m a x max( i++, j++ ) /* #define square( x ) x * x /* square( z + 1 ) < s t d i o. h > g e t c h a r p u t c h a r < c t y p e. h > # u n d e f #undef getchar int getchar( void ) # #define dprint( expr ) printf( #expr " = %g\n", expr ) dprint( x/y ); printf( "x/y" " = %g\n", x/y );

76 76 C printf( "x/y = %g\n", x/y ); " \" \ \\ ## # ## p a s t e #define paste( front, back ) front ## back paste(name, 1) n a m e 1 ## A 4-14 swap(t, x, y) t # i f s i z e o f 0 # e n d i f # e l i f # e l s e # e l i f i f else if # i f d e f i n e d ( ) 1 0 h d r. h #if!defined( HDR ) #define HDR /* hdr.h #endif # i f # e n d i f H D R # e n d i f S Y S T E M #if SYSTEM == SYSV #define HDR "sysv.h" #elif SYSTEM == BSD #define HDR "bsd.h" #elif SYSTEM == MSDOS #define HDR "msdos.h" #else #define HDR "default.h"

77 4 77 #endif # include HDR # i f d e f # i f n d e f # i f d e f # i f #ifdef HDR #define HDR /* hdr.h #endif

78 C 5 C g o t o ANSI C ANSI C void ( v o i d ) char * 5.1 ( ) c c h a r p c 5-1 & p = &c; c p p c & * x y i p

79 5 79 & * : int x = 1, y = 2, z[10]; int *ip; /* ip ip = &x; y = *ip; *ip = 0; ip = &z[0]; /* ip x /* y 1 /* x 0 /* ip z[0] x y z i p int *ip; *i p i n t double *dp, atof(char *); * d p a t o f ( s ) d o u b l e a t o f c h a r ( v o i d ) i p x x * ip *ip = *ip + 10; * ip 10 * & y = * ip + 1 i p 1 y * ip += 1 i p 1 ++*ip (*ip) ++ * i p i i p * + + i q iq = ip i p i q i i p

80 80 C 5.2 C s w a p swap(a, b); s w a p void swap(int x, int y) /* / int temp; temp = x; x = y ; y = temp; s w a p a b a b s w a p swap(&a, &b); & & a s w a p void swap(int * px, int * py) /* *px *py int temp; temp = *px; *px = *py; *py = temp; 5-2 g e t i n t g e t i n t 5-2 E O F ( ) g e t i n t s c a n f 7. 4 swap g e t i n t

81 5 81 int n, array[size] getint(int *); for ( n = 0; n< SIZE && getint(&array[n])!=eof n++) ; g e t i n t a r r a y [ n ] n 1 a r r a y [ n ] g e t i n t g e t i n t g e t i n t E O F 0 #include <ctype.h> int getch(void); void ungetch(int); /* getint: *pn int getint(int *pn) int c, sign; while (isspace(c = getch( ))) /* ; if (!isdigit(c) && c!= EOF && c!= '+' && c!='-') ungetch(c); /* return 0; sign = ( c = = '-' )? -1 : 1; if (c = = '+' c = = '-') c = getch( ); for (*pn = 0; isdigit(c); c = getch( )) *pn = 10 * * pn + (c - '0'); *pn *= sign; if (c!= EOF ) ungetch(c); return c; g e t i n t * p n g e t c h u n g e t c h ( 4. 3 ) g e t i n t 5-1 g e t i n t g e t i n t g e t f l o a t g e t f l o a 5.3 C

82 82 C int a[10] ; 1 0 a 1 0 a [ 0 ] a [ 1 ]... a [ 9 ] a [ i ] i p a int *pa; pa = &a[0] p a 0 p a a [ 0 ] 5-4 x = *pa; a [ 0 ] x 5-4 p a pa + 1 p p a + i p a i pa i p a i p a a [ 0 ] *(pa+1) a [ 1 ] p a + i a [ i ] *(pa+i) a [ i ] a 1 p a + 1 p a p a + i p i

83 pa = &a[0]; p a a 0 pa = &a[0] pa = a; a [ i ] *( a + i ) a [ i ] C *( a + i ) & & a [ i ] a + i a + i a i p a p a p a [ i ] * ( p a + i ) C pa = a p a + + a = pa a + s t r l e n /* strlen: s int strlen(char *s) int n; for (n = 0; *s!= '\0'; s++) n++; return n; s s + + s t r l e n s t r l e n strlen("hello, word"); strlen(array); strlen(ptr); char s[ ]; char *s; /* /* array 100 /* ptr

84 84 C a f ( &a[2] ) f ( a+2 ) a [ 2 ] f f f ( int arr[ ] )... f ( int *arr )... f p [ 1 ] p [ 2 ] p [ 0 ] 5.4 p p + + p p + = i p p i C a l l o c ( n ) n a l l o c a f r e e ( p ) a f r e e a l l o c a l l o c a f r e e m a l l o c f r e e 8. 7 a l l o c a l l o c b u f a l l o c f r e e a l l o c f r e e a l l o c f r e e s t a t i c m a l l o c a l l o c b u f a l l o c p a l l o c b u f a l l o c n a l l o c a l l o c b u f a l l o c a l l o c p

85 5 85 ) a l l o c p n a l l o c 0 p a l l o c b u f afree(p) a l l o c p 5-6 alloc alloc 5-6 #define ALLOCSIZE /* static char allocbuf[allocsize]; static char *allocp = allocbuf; /* alloc /* char *alloc(int n) /* n if (allocbuf + ALLOCSIZE - allocp >= n ) /* allocp += n; return allocp - n; /* else /* return 0; void afree(char *p) /* p if (p >= allocbuf && p <allocbuf + ALLOCSIZE) allocp = p; 0 static char *allocp = allocbuf; a l l o c p a l l o c b u f static char *allocp = &allocbuf[0]; 0 if ( allocbuf + ALLOCSIZE - allocp >= n ) /*

86 86 C n a l l o c p a l l o c b u f 1 a l l o c ) a l l o c C N U L L 0 NULL < s t d i o. h > N U L L if (allocbuf + ALLOCSIZE - allocp >= n) if (p >= allocbuf && p < allocbuf + ALLOCSIZE) p q = =! = < >= p q p < q 0 ( ) p + n p n p p + n n p p i n t n 4 p q p < q p + 1 p q s t r l e n /* strlen: s int strlen(char *s) char *p = s; while (*p!= '\0') p++; return p - s; p s w h i l e '\ 0 ' p p + + p p s

87 5 87 p ( < s t d d e f. h > p t r d i ff _ t s i z e _ t s t r l e n s i z e _ t s i z e o f ) p p + + p a l l o c a f r e e c h a r f l o a t 0 0 v o i d * 5.5 "I am a string" '\0' 1 printf("hello, world\n "); p r i n t f p m e s s a g e char *pmessage; pmessage = "now is the time"; p m e s s a g e C char amessage[ ] = "now is the time"; /* char *pmessage = "now is the time"; /* a m e s s a g e '/0' a m e s s a g e p m e s s a g

88 88 C strcpy(s, t) t s s = t s t r c p y 1 /* strcpy: t s void strcpy(char *s, char *t) int i; i = 0; while ((s[i] = t[i])!= '\0') i++; s t r c p y /* strcpy: t s 1 void strcpy(char *s, char *t) while ((* s = * t)!= '\0') s++; t++; s t r c p y s t t '\0' s s t r c p y /* strcpy: t s 2 void strcpy(char *s, char *t) while ((*s++ = *t++)!= '\0') ; s t * t + + t t s s '/0'

89 5 89 t s t '\0' ( ) '\ 0 ' 0 /* strcpy: t s 3 void strcpy(char *s, char *t) while (*s++ = *t++) ; C ( < s t r i n g. h > ) s t r c p y strcmp(s, t) s t s t 0 s t /* strcmp: s t 0 int strcmp(char *s, char *t) int i; for (i = 0; s[i] = = t[i]; i++) if (s[i] = = '\0') return 0; return s[i] - t[i]; s t r c m p : /* strcmp: s t 0 int strcmp(char *s, char *t) for (;*s = = *t; s++, t++) if (*s = = '\0') return 0; return *s - *t; + + * + *--p p p *p++ = val; val = *--p; /* val /* val

90 90 C 4. 3 < s t r i n g. h > s t r c a t strcat(s, t) t s 5-4 strend (s, t): t s s t r n c p y s t r n c a t s t r n c m p n strncpy(s, t, n) t n s B 5-6 g e t l i n e ( 1 4 ) a t o i i t o a ( ) r e v e r s e ( 3 ) s t r i n d e x g e t o p ( 4 ) 5.6 U N I X s o r t 3 S h e l l 4 s t r c m p

91 #include <stdio.h> #include <string.h> #define MAXLINES 5000 /* char *lineptr[maxlines]; /* int readlines(char *lineptr[ ], int nlines); void writelines(char *lineptr[ ], int nlines); void qsort(char *lineptr[ ], int left, int right); /* main( ) int nlines; /* if ((nlines = readlines(lineptr, MAXLINES)) >= 0) qsort(lineptr, 0, nlines-1); writelines(lineptr, nlines); return 0; else printf("error: input too big to sort\n"); return 1; #define MAXLEN 1000 /* int getline(char *, int); char *alloc(int); /* readlines: int readlines(char *lineptr[ ], int maxlines) int len, nlines; char *p, line[maxline]; nlines = 0;

92 92 C while ((len = getline(line, MAXLEN)) > 0) if (nlines >= maxlines (p = alloc(len)) = = NULL) return -1; else line[len-1] = '\0'; /* strcpy(p, line); lineptr[nlines++] = p; return nlines; /* writelines: void writelines(char *lineptr[ ], int nlines) int i; for ( i = 0; i < nlines; i++) printf("%s\n", lineptr[i]); g e t l i n e 1. 9 l i n e p t r char *lineptr[maxlines] l i n e p t r M A X L I N E S l i n e p t r [ i ] * l i n e p t r [ i ] i l i n e p t r w r i t e l i n e s /* writelines: void writelines(char *lineptr[ ], int nlines) while (nlines -- > 0) printf("%s\n", *lineptr++); * l i n e p t r * l i n e p t n l i n e 4 s t r c m p /* qsort: v[left]...v[right] void qsort(char * v[ ], int left, int right) int i, last;

93 5 93 void swap(char *v[ ], int i, int j); if (left >= right ) /* 2 return; swap(v, left, (left + right) / 2); last = left; for (i = left + 1; i <= right; i++) if (strcmp(v[i], v[left] < 0) swap(v, ++last, i); swap(v, left, last); qsort(v, left, last - 1); qsort(v, last + 1, right); s w a p /* swap: v[i] v[j] void swap(char *v[ ], int i, int j) char *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; v ( l i n e p t r ) t e m p 5-7 r e a d l i n e s a l l o c 5.7 C d a y _ o f _ y e a r m o n t h _ d a y m o n t h _ d a y month_day(1988, 60, &m, &d); m 2 d 29 ( ) ( 9 30 )

94 94 C 2 static char daytab[2][13] = 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ; /* day_of_year: int day_of_year(int year, int month, int day) int i, leap; leap = year%4 = = 0 && year%100!= 0 year%400 = = 0; for (i = 1; i < month; i++) day += daytab[leap][i]; return day; /* month_day: void month_day(int year, int yearday, int *pmonth, int *pda) int i, leap; leap = year%4 = =0 && year%100!= 0 year%400 = =0; for (i = 1; yearday > daytab[leap][i]; i++) yearday -= daytab[leap][i]; *pmonth = i; *pday = yearday; 0 ( ) 1 ( ) l e a p 0 1 l e a p d a y t a b d a y t a b d a y _ o f _ y e a r m o n t h _ d a y d a y t a b d a y t a b C daytab[i][j] /* [ ][ ] daytab[i, j] /* C d a y t a b 0 1 ~ 12 0 ~ 11

95 d a y t a b f f f(int daytab[2][13])... f(int daytab[ ][13])... f(int (*daytab)[13]) [ ] * int *daytab[13] d a y _ o f _ y e a r m o n t h _ d a y 5.8 m o n t h _ n a m e ( n ) n m o n t h _ n a m e /* month_name: n char * month_name(int n) static char *name[ ] = "Illegal month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" return ( n < 1 n > 12 )? name[0] : name[n]; n a m e l i n e p t r

96 96 C n a m e i n a m e [ i ] n a m e 5.9 C n a m e int a[10][20]; int *b[10]; a [ 3 ][ 4 ] b [ 3 ][ 4 ] a r o w + c o l a [ r o w ][ c o l ] b 10 b b m o n t h _ n a m e char *name[ ] = "Illegal month", "Jan", "Feb", "Mar"; 5-10 char aname[ ][15] = " Illegal month", "Jan", "Feb", "Mar" ; d a y _ o f _ y e a r m o n t h _ d a y 5.10 C ( a rg c ) ( a rg v )

97 5 97 e c h o echo hello, world hello, world C a rg v [ 0 ] a rg c 1 a rg c 1 a rg c 3 a rg v [ 0 ] a rg v [ 1 ] a rg v [ 2 ] e c h o h e l l o w o r l d a rg v [ 1 ] a rg v [ a rg c 1 ] C a rg v [ a rg c ] 5-11 e c h o 1 a rg v #include <stdio.h> /* 1 main(int argc, char *argv[ ]) int i; for (i = 1; i < argc; i++) printf("%s%s", argv[i], (i < argc -1)? " " : " "); printf("\n"); return 0; 5-11 a rg v 2 a rg v a rg c a rg v #include <stdio.h> /* 2 main(int argc, char *argv[ ]) while (--argc > 0) printf("\n"); return 0; printf("%s%s", argv[i], (i < argc -1)? " " : ""); a rg v ( + + a rg v ) a rg v [ 1 ] a rg v [ 0 ] a rg v a rg a rg c 0 p r i n t f printf((argc > 1)? "%s " : "%s", *++argv);

98 98 C p r i n t f U N I X g r e p #include <stdio.h> #include <string.h> #define MAXLINE 1000 int getline(char *line, int max); /* find: main(int argc, char *argv[ ]) char line[maxline]; int found = 0; if (argc!= 2) printf("usage: find pattern\n"); else while (getline(line, MAXLINE) > 0) if (strstr(line, argv[1])!= NULL) printf("%s", line); found++; return found; strstr(s, t) t s t s < s t r i n g. h > U N I X C x (x e x c e p t ) n (n n u m b e r ) find -x -n find -nx #include <stdio.h>

99 5 99 #include <string.h> #define MAXLINE 1000 int getline(char * line, int max); /* find: main(int argc, char *argv[ ]) char line[maxline]; long lineno = 0; int c, except = 0, number = 0, found = 0; while (- -argc > 0 && (* ++argv)[0] = = '-') while (c = *++argv[0]) switch (0) case 'x': except = 1; break; case 'n': number = 1; break; default: printf("find: illegal option %c\n", c); argc = 0; found = -1; break; if (argc!=1) printf("usage: find -x -n pattern\n"); else while (getline(line, MAXLINE) > 0) lineno++; if ((strstr(line, *argv)!= NULL)!= except) if (number) printf("%d:", lineno); printf("%s", line); found++; return found; a rg c a rg v a rg c a rg v a rg c 1 * a rg v * + + a rg v (* + + a rg v )[ 0 ] ( ** + + a rg v ) [ ] * + +

100 100 C * + + ( a rg v [ 0 ]) * + + a rg v [ 0 ] * + + a rg v [ 0 ] a rg v [ 0 ] 5-10 e x p r expr * 2 (3 + 4) 5-11 e n t a b d e t a b ( 1 ) 5-12 e n t a b d e t a b entab -m +n m n ( ) 5-13 t a i l n 10 tail -n n n C n s t r c m p s t r c m p n u m c m p m a i n q s o r t

101 5 101 #include <stdio.h> #include <string.h> #define MAXLINES 5000 char *lineptr[maxlines]; /* /* int readlines(char *lintptr[ ], int nlines); void writelines(char *lineptr[ ], int nlines); void qsort(void *lineptr[ ], int left, int right, int (*comp) (void *, void *)); int numcmp(char *, char *); /* main(int argc, char *argv[ ]) int nlines; int numeric = 0; /* /* 1 if (argc > 1 && strcmp(argv[1], "-n ") = = 0) numeric = 1; if ((nlines = readlines(lineptr, MAXLINES)) >= 0) qsort((void **) lineptr, 0, nlines-1, (int (*)(void *, void *)) (numeric? numcmp : strcmp)); writelines(lineptr, nlines); return 0; else printf("input too big to sort\n"); return 1; q s o r t s t r c m p n u m c m p & q s o r t q s o r t v o i d * v o i d v o i d * q s o r t v o i d * v o i d /* qsort: v[left]... v[right] void qsort(void *v[ ], int left, int right, int (*comp) (void *, void *)) int i, last; void swap(void *v[ ], int, int);

102 102 C if (left >= right) /* 2 return; swap(v, left, (left + right) / 2); last = left; for (i = left + 1; i <= right; i++) if ((*comp) (v[i], v[left]) < 0) swap(v, ++last, i); swap(v, left, last); qsort(v, left, last - 1, comp); qsort(v, last+1, right, comp); q s o r t int (*comp) (void *, void *) c o m p v o i d * i n t i f if ((*comp) (v[i], v[left]) < 0) c o m p c o m p * c o m (*comp) (v[i], v[left]) int *comp(void *, void *) /* c o m p s t r c m p n u m c m p a t o f #include <stdio.h> /* numcmp: s1 s2 int numcmp(char *s1, char *s2) double v1, v2; v1 = atof(s1); v2 = atof(s2); if (v1 < v2) return -1 ; else if (v1 > v2) return 1; else return 0; s w a p s w a p v[ ] void * void swap(void *v [ ], int i, int j)

103 5 103 void *temp; temp = v[i]' v[i] = v[j]; v[j] = temp; 5-14 r ( ) r n 5-15 f a A 5-16 d f C C int * f( ); /* f: int (*pf) ( ); /* pf: * ( ) t y p e d e f 6. 7 C d c l C char **argv argv: int (*daytab) [13] daytab: 13 int *daytab[13] daytab: 13 void *comp( )

104 104 C comp: void (*comp) ( ) comp: char (*(*x( )) [ ]) ( ) x: char (*(*x[3])( )) [5] x: 3 5 d c l A. 8. 5, : * : ( ) ( ) [ ] * C (*pfa[ ]) ( ) d c l p f a pfa[ ] *pfa[ ] (*pfa[ ]) d c l d c l d i r d c l

105 5 105 /*dcl: void dcl(void) int ns; for (ns = 0; gettoken( ) = = '*'; ) ns++; dirdcl( ); while (ns- - > 0) strcat(out, "pointer to"); /* '*' /* dirdcl: void dirdcl(void) int type if (tokentype = = '(' ) /* ( ) dcl( ); if (tokentype!= ')' ) printf("error: missing ) \n"); else if (tokentype = = NAME) /* strcpy(name, token); else printf("error: expected name or (dcl)\n"); while ((type = gettoken( )) = = PARENS type = = BRAKCETS) if (type = = PARENS) strcat(out, "function returning"); else strcat(out, " array"); strcat (out,token); strcat(out, " of"); d c l c h a r i n t c o n s #include <stdio.h> #include <string.h> #include <ctype.h> #define MAXTOKEN 100

106 106 C enum NAME, PARENS, BRACKETS void dcl(void); void dirdcl(void); int gettoken(void); int tokentype; char token[maxtoken]; char name[maxtoken]; char datatype[maxtoken]; char out[1000]; /* /* /* /* char int /* main( ) while (gettoken( )!= EOF) /* strcpy(datatype, token); out[0] = '\0'; dcl( ); /* /* if (tokentype!= '\n') printf("syntax error\n"); printf("%s: %s %s\n", name, out, datatype); return 0; g e t t o k e n int gettoken(void) int c, getch(void); void ungetch(int); char *p = token; /* while (( c = getch( )) = = ' ' c = = '\t') ; if (c = = '(' ) if (( c = getch)) = = ')') strcpy(token, "( )"); return tokentype = PARENS; else ungetch(c); return tokentype = '('; else if (c = = '[') for (*p++ = c; (*p++ = getch( ))!= ']'; ) ; *p = '\0'; return tokentype = BRACKETS; else if (isalpha(c) for (*p++ = c; isalnum(c = getch( )); )

107 5 107 *p++ = c; *p = '\0'; ungetch(c); return tokentype = NAME; else return tokentype = c; g e t c h u n g e t c h 4 u n d c l x x ( ) * [ ] * ( ) char char (* (* x( ) ) [ ] ) ( ) g e t t o k e n u n d c l d c l /* undcl: main( ) int type; char temp[maxtoken]; while (gettoken( ))!= EOF) strcpy(out, token); while ((type = gettoken( ))!= '\n') if (type = =PARENS type = = BRACKETS) strcat(out, token); else if (type = = '*') sprintf(temp, "(*%s)", out); strcpy(out, temp); else if (type = = NAME) sprintf(temp, "%s %s", token, out); strcpy(out, tmep); else printf("invalid input at %s\n", token); printf("%s\n", out); return 0; 5-18 d c l 5-19 u n d c l 5-20 d c l c o n s t

108 C 6 P a s c a l C ANSI C 6.1 x y x y 6-1 struct point int x; int y; ; s t r u c t s t r u c t 6-1 p o i n t

109 6 109 struct... x, y, z int x, y, z x y z p o i n t struct point pt; p o i n t p t struct point maxpt = 320, 200 ;. p t printf("%d, %d", pt.x, pt.y); (0, 0) p t double dist, sqrt(double); dist = sqrt((double)pt.x * pt.x + (double)pt.y * pt.y); 6-2 struct rect struct point pt1; struct point pt2; ; r e c t p o i n t s c r e e n struct rect screen; screen.pt1.x s c r e e n p t 1 x &

110 110 C m a k e p o i n t p o i n /* makepoint: x y struct point makepoint(int x, int y) struct point temp; temp.x = x; temp.y = y; return temp; m a k e p o i n t struct rect screen; struct point middle; struct point makepoint(int, int); screen.pt1 = makepoint(0, 0); screen.pt2 = makepoint(xmax, YMAX); middle = makepoint((screen.pt1.x + screen.pt2.x) / 2, (screen.pt1.y + screen.pt2.y) / 2); /* addpoint: struct point addpoint(struct point p1, struct point p2) p1.x += p2.x; p1.y += p2.y; return p1; p 1 p t i n r e c t /* ptinrect: p r 1 0 int ptinrect(struct point p, struct rect r) return p.x >= r.pt1.x && p.x < r.pt2.x && p.y >= r.pt1.y && p.y < r.pt2.y; p t 1 p t 2 #define min(a, b) ((a) < (b)? (a) : (b)) #define max(a, b) ((a) > (b)? (a) : (b))

111 6 111 /* canonrect : struct rect canonrect(struct rect r) struct rect temp; temp.pt1.x = min(r.pt1.x, r.pt2.x); temp.pt1.y = min(r.pt1.y, r.pt2.y); temp.pt2.x = max(r.pt1.x, r.pt2.x); temp.pt2.y = max(r.pt1.y, r.pt2.y); return temp ; struct point *pp; p p struct point p p p o i n t p p ( * p p ). x ( * p p ). y p p struct point origin, *pp; pp = &origin; printf ("origin is (%d, %d) \n ", (*pp).x, (*pp).y); (*p p ). x. * *p p. x *( p p. x ) x p p-> > printf("origin is (%d, %d) \n ", pp->x, pp->y);. > struct rect r, *rp = &r; r.pt1.x rp->pt1.x (r.pt1).x (rp->pt1).x. > [ ] struct int len; char *str; *p; ++p->len

112 112 C l e n p > (p->len) (++p)->len p 1 l e n p++ ->len l e n p 1 p > s t r s t r p > s t r + + s t r s t r 1 s + + ( p > s t r ) + + s t r 1 p + + > s t r s t r p C k e y w o r d k e y c o u n t char *keyword[nkeys]; int keycount[nkeys]; char *word; int count; struct key char *word; int count; keytab[nkeys]; k e y k e y t a b k e y t a struct key char *word; int count; ; struct key keytab[nkeys] k e y t a b struct key char *word; int count; keytab[ ] = "auto", 0,

113 6 113 "break", 0, "case", 0, "char", 0, "const", 0, "continue", 0, "default", 0, /* "unsigned", 0, "void", 0, "volatile", 0, "while", 0 ; "auto", 0, "break", 0, "case", 0, [] k e y t a b k e y t a b g e t w o r d 3 #include <stdio.h> #include <ctype.h> #include <string.h> #define MAXWORD 100 int getword ( char *, int ); int binsearch ( char *, struct key *, int ); /* C main ( ) int n; char word[maxword]; while ( getword (word, MAXWORD )!= EOF ) if ( isalpha ( word[0] )) if ( ( n = binsearch ( word, keytab, NKEYS ) ) >= 0 ) keytab[n].count++; for ( n = 0; n < NKEYS; n++ ) if ( keytab[n].count > 0 ) printf ( "%4d %s\n ", keytab[n].count, keytab[n].word ); return 0;

114 114 C /* binsearch: tab[0] tab[n-1] int binsearch ( char *word, struct key tab[ ], int n ) int cond; int low, high, mid; low = 0; high = n-1; while ( low <= high ) mid = ( low + high ) / 2; if ( ( cond = strcmp ( word, tab[mid].word ) ) < 0 ) high = mid - 1; else if ( cond > 0 ) low = mid + 1; else return mid; return -1; g e t w o r d N K E Y S k e y t a b k e y t a b keytab / struct key C s i z e o f sizeof sizeof ( ) s i z e o f s i z e _ t < s t d d e f. h > # d e f i n e N K E Y S #define NKEYS ( sizeof keytab / sizeof ( struct key ) )

ebook 241-1

ebook 241-1 更 多 免 费 资 源 :www.fishc.com 第 1 页 C1 C C C 1.1 hello, world C hello, world #include main() printf("hello, world\n"); 更 多 免 费 资 源 :www.fishc.com 第 2 页 U N I X. c h e l l o. cc hello.c a. o u t

More information

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

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

More information

CC213

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

More information

新版 明解C++入門編

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

More information

untitled

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

More information

Ps22Pdf

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

More information

C 1

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

More information

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

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023) ( CIP) /. :, 2005. 2 ( ) ISBN 7-5624-3339-9.......... TP311. 1 CIP ( 2005) 011794 : : : : * : : 174 ( A ) :400030 : ( 023) 65102378 65105781 : ( 023) 65103686 65105565 : http: / /www. cqup. com. cn : fxk@cqup.

More information

untitled

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

More information

C/C++ 语言 - 循环

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

More information

CC213

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

More information

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

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

More information

FY.DOC

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

More information

nooog

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

More information

四川省普通高等学校

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

More information

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

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

More information

目 录 1 新 闻 政 策 追 踪... 4 1.1 住 建 部 : 坚 持 因 城 施 策 完 善 房 地 产 宏 观 调 控... 4 2 行 业 数 据 追 踪... 4 2.1 限 购 政 策 落 地, 新 房 成 交 回 落... 4 2.2 库 存 微 降, 一 线 去 化 表 现 稍

目 录 1 新 闻 政 策 追 踪... 4 1.1 住 建 部 : 坚 持 因 城 施 策 完 善 房 地 产 宏 观 调 控... 4 2 行 业 数 据 追 踪... 4 2.1 限 购 政 策 落 地, 新 房 成 交 回 落... 4 2.2 库 存 微 降, 一 线 去 化 表 现 稍 Sep/15 Oct/15 Nov/15 Dec/15 Jan/16 Feb/16 Mar/16 Apr/16 May/16 Jun/16 Jul/16 Aug/16 房 地 产 行 业 行 业 研 究 - 行 业 周 报 行 业 评 级 : 增 持 报 告 日 期 :216-9-14 4% 3% 2% 1% % -1% -2% 沪 深 3 SW 房 地 产 研 究 员 : 宫 模 恒 551-65161836

More information

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

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

More information

epub 33-8

epub 33-8 8 1) 2) 3) A S C I I 4 C I / O I / 8.1 8.1.1 1. ANSI C F I L E s t d i o. h typedef struct i n t _ f d ; i n t _ c l e f t ; i n t _ m o d e ; c h a r *_ n e x t ; char *_buff; /* /* /* /* /* 1 5 4 C FILE

More information

untitled

untitled 1 2 3 4 5 A 800 700 600 500 400 300 200 100 0-100 10000 9500 9000 8500 8000 7500 7000 6500 6000 2006.1-2007.5 A 1986.1-1991.12 6 7 6 27 WIND A 52.67 2007 44 8 60 55 50 45 40 35 30 25 20 15 10 2001-05 2002-02

More information

C

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

More information

C++ 程式設計

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

More information

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

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

More information

C程序设计语言

C程序设计语言 C 505 1 C B.W.Kernighan, D.M.Ritchie, 2 C 3 C from C Programming Language ---- P13. 1-4 ; P20 1-8, 1-9, 1-10; P24 1-13; P31 1-18; P34 1-20, 1-22, 1-23; P46 2-3; P49 2-6, 2-8; P58 3-1; P60 3-2; P63 3-3;

More information

投资高企 把握3G投资主题

投资高企 把握3G投资主题 行 业 研 究 东 兴 证 券 股 份 有 限 公 司 证 券 研 究 报 告 维 持 推 荐 白 酒 行 业 食 品 饮 料 行 业 2016 年 第 21 周 周 报 投 资 摘 要 : 上 周 市 场 表 现 和 下 周 投 资 策 略 上 周 食 品 饮 料 行 业 指 数 下 跌 0.89%, 跑 输 沪 深 300 指 数 1 个 百 分 点 食 品 饮 料 细 分 行 业 1 个 上

More information

内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2

内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2 第 六 讲 指 针 与 字 符 串 1 内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2 指 针 什 么 是 指 针 指 针 的 定 义 与 运 算 指 针 与 一 维 数 组 指 针 数 组 行 指 针 与 二 维 数 组 指 针 与 引 用 指 针 与 函 数 3 指 针 定 义 什 么 是 指 针 指 针 变 量, 简 称 指 针, 用 来 存 放

More information

附錄C.doc

附錄C.doc C C C-1 C -2 C -3 C -4 C -5 / C -6 2 C/C++ C-1 FILE* fopen(const char* filename, const char* mode) filename NULL FILE* freopen(const

More information

5. 6. 310-00 7. 8. 9. 2

5. 6. 310-00 7. 8. 9. 2 Mondeo 2003-03-08 2003 / MondeoGhia-X, 3S71-9H307-FA 310-069 (23-055) ( ) 1. 310-00 2. 310-00 3. 100-02 4. 1 5. 6. 310-00 7. 8. 9. 2 10 10. 11. 12. 3 13. 1. 2. 14. 310-00 15. 4 16. 17. 18. 19. 20. ( )

More information

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

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

More information

2-2

2-2 ... 2-1... 2-2... 2-6... 2-9... 2-12... 2-13 2005 1000 2006 20083 2006 2006 2-1 2-2 2005 2006 IMF 2005 5.1% 4.3% 2006 2005 3.4% 0.2% 2006 2005 911 2005 2006 2-3 2006 2006 8.5% 1.7 1.6 1.2-0.3 8.3 4.3 3.2

More information

chap07.key

chap07.key #include void two(); void three(); int main() printf("i'm in main.\n"); two(); return 0; void two() printf("i'm in two.\n"); three(); void three() printf("i'm in three.\n"); void, int 标识符逗号分隔,

More information

2 图 1 新 民 科 技 2010 年 主 营 业 务 收 入 结 构 图 2 新 民 科 技 2010 年 主 营 业 务 毛 利 结 构 印 染 加 工 10.8% 其 他 4.8% 丝 织 品 17.2% 印 染 加 工 7.8% 其 他 4.4% 丝 织 品 19.1% 涤 纶 长 丝 6

2 图 1 新 民 科 技 2010 年 主 营 业 务 收 入 结 构 图 2 新 民 科 技 2010 年 主 营 业 务 毛 利 结 构 印 染 加 工 10.8% 其 他 4.8% 丝 织 品 17.2% 印 染 加 工 7.8% 其 他 4.4% 丝 织 品 19.1% 涤 纶 长 丝 6 买 入 维 持 上 市 公 司 年 报 点 评 新 民 科 技 (002127) 证 券 研 究 报 告 化 工 - 基 础 化 工 材 料 与 制 品 2011 年 3 月 15 日 2010 年 业 绩 符 合 预 期, 增 发 项 目 投 产 在 即 基 础 化 工 行 业 分 析 师 : 曹 小 飞 SAC 执 业 证 书 编 号 :S08500210070006 caoxf@htsec.com

More information

ebook15-C

ebook15-C C 1 1.1 l s ( 1 ) - i i 4. 14 - d $ l s -ldi /etc/. /etc/.. - i i 3077 drwxr-sr-x 7 bin 2048 Aug 5 20:12 /etc/./ 2 drwxr-xr-x 13 root 512 Aug 5 20:11 /etc/../ $ls -ldi /. /..... i 2 2 drwxr-xr-x 13 root

More information

宏碩-觀光指南coverX.ai

宏碩-觀光指南coverX.ai Time for Taiwan Taiwan-The Heart of Asia Time for Taiwan www.taiwan.net.tw Part 1 01 CONTENTS 04 Part 1 06 Part 2 GO 06 14 22 30 38 Part 3 200+ 02 Part 1 03 1 2 3 4 5 6 04 Jan Feb Mar Apr May Jun Part

More information

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

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

More information

untitled

untitled 1 DBF (READDBF.C)... 1 2 (filetest.c)...2 3 (mousetes.c)...3 4 (painttes.c)...5 5 (dirtest.c)...9 6 (list.c)...9 1 dbf (readdbf.c) /* dbf */ #include int rf,k,reclen,addr,*p1; long brec,erec,i,j,recnum,*p2;

More information

专题研究.doc

专题研究.doc 2005 2 1 14 11.2 14 15 15 14 Yunyang.zhao@morningstar.com 500 MSCI 1991 2001 53 458 115 94 24 316 26 494 125 1995 26 14 1993 1993 1997 http://cn.morningstar.com 1998 1 2001 6 2000 1993 90 2002 2001 51

More information

untitled

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

More information

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

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

More information

untitled

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

More information

産 産 産 産 産 爲 爲 爲 爲 185 185

産 産 産 産 産 爲 爲 爲 爲 185 185 産 産 184 産 産 産 産 産 爲 爲 爲 爲 185 185 爲 爲 爲 産 爲 爲 爲 産 186 産 爲 爲 爲 爲 爲 爲 顔 爲 産 爲 187 爲 産 爲 産 爲 産 爲 爲 188 産 爲 爲 酰 酰 酰 酰 酰 酰 産 爲 爲 産 腈 腈 腈 腈 腈 爲 腈 腈 腈 腈 爲 産 189 産 爲 爲 爲 爲 19 産 爲 爲 爲 爲 爲 爲 191 産 192 産 爲 顔 爲 腈

More information

[改訂新版]C言語による標準アルゴリズム事典

[改訂新版]C言語による標準アルゴリズム事典 iii C 1991 SEND + MORE = MONEY C 100 2003 Java 2003 27 PC-9800 C BMP SVG EPS BMPSVG WindowsMacLinux Web iv int main() int main(void) EXIT_SUCCESS 0 https://github.com/okumuralab/ algo-c TEX TEX PDF PDF

More information

Ps22Pdf

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

More information

1. 发 行 情 况 格 力 地 产 于 2014 年 12 月 25 日 发 行 9.8 亿 元 可 转 债 其 中, 原 股 东 优 先 配 售 2.1225 亿 元 (21.225 万 手 ), 占 本 次 发 行 总 量 的 21.66% 网 上 向 一 般 社 会 公 众 投 资 者 发

1. 发 行 情 况 格 力 地 产 于 2014 年 12 月 25 日 发 行 9.8 亿 元 可 转 债 其 中, 原 股 东 优 先 配 售 2.1225 亿 元 (21.225 万 手 ), 占 本 次 发 行 总 量 的 21.66% 网 上 向 一 般 社 会 公 众 投 资 者 发 衍 生 品 市 场 衍 生 品 市 场 转 债 研 究 转 债 研 究 证 券 研 究 报 告 证 券 研 究 报 告 转 债 定 价 报 告 2015 年 1 月 11 日 格 力 转 债 (110030) 上 市 定 价 分 析 公 司 资 料 : 转 债 条 款 : 发 行 日 到 期 日 期 限 转 股 期 限 起 始 转 股 日 发 行 规 模 净 利 润 2014-12-25 2019-12-24

More information

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

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

More information

c_cpp

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

More information

<4D F736F F F696E74202D20BDD3CCECC1ABD2B6B1CCA3ACD3B3C8D5BAC9BBA8BAEC2E707074>

<4D F736F F F696E74202D20BDD3CCECC1ABD2B6B1CCA3ACD3B3C8D5BAC9BBA8BAEC2E707074> 接 天 莲 叶 碧, 映 日 荷 花 红 A 股 投 资 策 略 更 新 兴 业 证 券 研 发 中 心 策 略 研 究 员 张 忆 东 28 年 7 月 要 点 : 从 谨 慎 到 谨 慎 乐 观 中 空 短 多 博 弈 政 策 和 5 月 份 写 的 中 期 策 略 时 间 的 玫 瑰 相 比, 我 们 的 策 略 基 调 未 变 : 熊 市 难 改, 结 构 性 机 会 增 多 经 济 下 行

More information

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

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

More information

<4D6963726F736F667420576F7264202D20CAFDBEDDCFC2D6DCB9ABB2BC20CAD0B3A1B3E5B8DFC8D4D3D0D5F0B5B42E646F63>

<4D6963726F736F667420576F7264202D20CAFDBEDDCFC2D6DCB9ABB2BC20CAD0B3A1B3E5B8DFC8D4D3D0D5F0B5B42E646F63> 2010 年 8 月 8 日 市 场 策 略 第 一 创 业 研 究 所 分 析 师 : 于 海 涛 S1080200010003 电 话 :0755-25832792 邮 件 :yuhaitao@fcsc.cn 沪 深 300 交 易 数 据 年 初 涨 跌 幅 : -18.96% 日 最 大 涨 幅 : 3.78%(5/24) 日 最 大 跌 幅 : -5.36%(4/19) A 股 基 本 数

More information

untitled

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

More information

行 业 研 究 证 券 行 业 周 报 1 1. 行 业 一 周 走 势 上 周 (214.3.3-214.3.7, 下 同 ) 沪 深 3 下 降.49%, 券 商 行 业 下 降 2.36%, 跑 输 大 盘 上 市 券 商 中 太 平 洋 上 涨 1.2%, 涨 幅 最 大 ; 广 发 证 券

行 业 研 究 证 券 行 业 周 报 1 1. 行 业 一 周 走 势 上 周 (214.3.3-214.3.7, 下 同 ) 沪 深 3 下 降.49%, 券 商 行 业 下 降 2.36%, 跑 输 大 盘 上 市 券 商 中 太 平 洋 上 涨 1.2%, 涨 幅 最 大 ; 广 发 证 券 市 场 表 现 增 持 维 持 4% 券 商 沪 深 3 3% 行 业 研 究 国 金 证 券 手 机 版 佣 金 宝 上 线 证 券 行 业 周 报 (214.3.3-214.3.7) 证 券 研 究 报 告 证 券 信 托 行 业 214 年 3 月 1 日 2% 1% % -1% -2% -3% 11-8 11-1 11-12 12-2 12-4 12-6 12-8 12-1 12-12 13-2

More information

信息管理部2003

信息管理部2003 23 7 3 22 28451642 E-mail wpff@eyou.com 23 1 23 5 22 2 3 4 628 6688 866 62 52 956 46 817 912 696 792 6.5% 1: 2: -2.% -1.5% -19.% -27.6% 33.6 3.45 [2.22%] 5A:6.94 1A:9.89 2A:9.51 3A:8.44 22.14 11.23 1-1-12

More information

ebook8-30

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

More information

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

More information

<4D6963726F736F667420576F7264202D2047CEF7B7C920B9ABCBBED1D0BEBFB1A8B8E62E646F63>

<4D6963726F736F667420576F7264202D2047CEF7B7C920B9ABCBBED1D0BEBFB1A8B8E62E646F63> 公 司 研 究 G 西 飞 (000768): 大 股 东 的 飞 机 总 装 资 产 值 得 期 待 增 持 军 工 机 械 行 业 当 前 股 价 :9.74 元 报 告 日 期 :2006 年 7 月 25 日 主 要 财 务 指 标 ( 单 位 : 百 万 元 ) 2005A 2006E 2007E 2008E 主 营 业 务 收 入 1,180 1,686 2,163 2,798 (+/-)

More information

untitled

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

More information

(Microsoft PowerPoint - 2011 [L So] \272C\251\312\252\375\266\353\251\312\252\315\257f [\254\333\256e\274\322\246\241])

(Microsoft PowerPoint - 2011 [L So] \272C\251\312\252\375\266\353\251\312\252\315\257f [\254\333\256e\274\322\246\241]) 慢 性 阻 塞 性 肺 病 (COPD) 冬 令 殺 手 冬 令 殺 手 蘇 潔 瑩 醫 生 東 區 尤 德 夫 人 那 打 素 醫 院 內 科 部 呼 吸 科 副 顧 問 醫 生 慢 性 阻 塞 性 肺 病 (COPD) 慢 性 阻 塞 性 肺 病 簡 稱 慢 阻 肺 病, 主 要 包 括 慢 性 支 氣 管 炎 和 肺 氣 腫 兩 種 情 況 患 者 的 呼 吸 道 受 阻, 以 致 氣 流 不

More information

ebook14-4

ebook14-4 4 TINY LL(1) First F o l l o w t o p - d o w n 3 3. 3 backtracking parser predictive parser recursive-descent parsing L L ( 1 ) LL(1) parsing L L ( 1 ) L L ( 1 ) 1 L 2 L 1 L L ( k ) k L L ( 1 ) F i r s

More information

欢迎光临兴业证券 !

欢迎光临兴业证券 ! 2009 08 09 2 3 4 08 09 5 14402.56 40.95% 622.92 43.57% 4753.39 31.90% 302.05 45.01% 4020.24 26.03% 361.51 27.32% 23176.19 36.24% 1286.48 38.91% : 6 7 15.00% 20.00% 25.00% 30.00% 35.00% 40.00% 45.00% 50.00%

More information

Microsoft Word - 第四章 資料分析

Microsoft Word - 第四章  資料分析 第 四 章 資 料 分 析 本 研 究 針 對 等 三 報, 在 馬 英 九 擔 任 台 北 市 長 台 北 市 長 兼 國 民 黨 主 席, 以 及 國 民 黨 主 席 之 從 政 階 段 中 ( 共 計 八 年 又 二 個 月 的 時 間, 共 855 則 新 聞, 其 中 179 則, 348 則, 328 則 ), 報 導 馬 英 九 新 聞 時 使 用 名 人 政 治 新 聞 框 架 之

More information

{ } 09:00~11:00 15:00~17:

{ } 09:00~11:00 15:00~17: { } { } 09:00~11:00 15:00~17:00 0916-126-966 0910-254-214 2 3 { 5 } { } Foting 4 Ina { } Nakaw DIY 5 1. NT200 3 2. 12 1 NT100 1 3. NT150 1-2 Ina 4. NT150 1 14 139 Ina Ina 0913-215799 0939-436078 http://tw.myblog.yahoo.com/guanshan-amisrice/

More information

3.1 num = 3 ch = 'C' 2

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

More information

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

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

More information

untitled

untitled 29 12 1 21-53519888-1922 Ch57261821@yahoo.com.cn 11 12.78 1.6 95.36 1 114.88 6 3 6% 8 35.% 3.% 25.% 2.% 15.% 1.% 5.%.% -5.% -1.% -15.% 9-6 9-6 9-7 9-7 9-7 9-8 9-8 9-8 9-9 9-9 9-1 9-1 9-11 9-11 9-11 9-12

More information

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

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

More information

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

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

More information

华恒家庭网关方案

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

More information

<4D6963726F736F667420576F7264202D2031383939D0CBB4EFB9FABCCA2D4358582D3031313132303130B8FCD0C2B1A8B8E6B7B1CCE52E646F63>

<4D6963726F736F667420576F7264202D2031383939D0CBB4EFB9FABCCA2D4358582D3031313132303130B8FCD0C2B1A8B8E6B7B1CCE52E646F63> 興 達 國 際 (1899) 買 入 更 新 報 告 1 日 矽 片 切 割 線 將 貢 獻 新 利 潤, 調 升 目 標 價 至 1.1 港 元 21 年 1-9 月 中 國 子 午 輪 胎 產 量 同 比 增 長 25.3% 目 前 中 國 汽 車 存 量 市 場 為 85 萬 輛 左 右, 工 信 部 預 計 到 22 年 將 超 過 2 億 輛, 中 國 汽 車 存 量 市 場 將 帶 來

More information

基金池周报

基金池周报 基 金 研 究 / 周 报 关 注 新 华 优 选 成 长 等 零 存 整 取 型 基 金 民 生 证 券 基 金 池 动 态 周 报 民 生 精 品 --- 基 金 研 究 周 报 2011 年 05 月 03 日 建 议 资 金 充 裕 渴 望 在 中 长 期 获 取 超 额 收 益 的 投 资 者 关 注 华 夏 大 盘 精 选 (000011.OF ) 大 摩 资 源 优 选 混 合 ( 163302.OF

More information

模 型 更 新 时 间 :2010.03.25 股 票 研 究 原 材 料 建 材 评 级 : 上 次 评 级 : 目 标 价 格 : 24.00 上 次 预 测 : 22.00 当 前 价 格 : 17.15 公 司 网 址 公 司 简 介 公 司 是 一 个 以

模 型 更 新 时 间 :2010.03.25 股 票 研 究 原 材 料 建 材 评 级 : 上 次 评 级 : 目 标 价 格 : 24.00 上 次 预 测 : 22.00 当 前 价 格 : 17.15 公 司 网 址  公 司 简 介 公 司 是 一 个 以 股 票 研 究 公 司 更 新 报 告 插 上 区 域 振 兴 的 翅 膀 :5 大 区 域 规 划 本 身 稀 缺 韩 其 成 021-38676162 hanqicheng@gtjas.com S0880208070351 本 报 告 导 读 : 冀 东 水 泥 经 营 区 域 中 有 环 渤 海 沈 阳 内 蒙 古 陕 西 吉 林 5 个 区 域 涉 及 国 家 振 兴 规 划, 这 本 身

More information

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

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

More information

PowerPoint Presentation

PowerPoint Presentation 推 票 蕴 含 的 投 资 机 会 卖 方 分 析 师 重 点 报 告 效 应 研 究 证 券 分 析 师 刘 均 伟 A0230511040041 夏 祥 全 A0230513070002 2014.4 主 要 内 容 1. 卖 方 分 析 师 推 票 的 时 滞 性 蕴 含 了 事 件 投 资 机 会 2. 卖 方 分 析 师 重 点 报 告 首 次 效 应 3. 卖 方 分 析 师 重 点 报

More information

第3章.doc

第3章.doc 3 3 3 3.1 3 IT Trend C++ Java SAP Advantech ERPCRM C++ C++ Synopsys C++ NEC C C++PHP C++Java C++Java VIA C++ 3COM C++ SPSS C++ Sybase C++LinuxUNIX Motorola C++ IBM C++Java Oracle Java HP C++ C++ Yahoo

More information

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

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

More information

Learn_Perl 3-02.pdf

Learn_Perl 3-02.pdf 2 2. 1 h e l l o h e l l o 23 2 4 2.2 2.2.1 2.2.2 d o u b l e 1 e - 1 0 0 1 e 1 0 0 i n t e g e r 2 5 1.25 2.000 3.0 7.25e45 # 7.25 10 45-6.5e24 # 6.5 10 24 # -12e-24 # 12 10-24 # -1.2E-23 # -- E 2.2.3

More information

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

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

More information

第11章 可调内核参数

第11章 可调内核参数 11 11 Unix BSD 4.4 Linux sysctl Unix Linux /proc window /proc /proc/sys /proc/sys sysctl Unix root /proc/sys/vm root /proc/sys sysctl /proc/sys struct ctl_table 18274 struct ctl_tables /proc/sys struct

More information

untitled

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

More information

untitled

untitled 28 12 17 28.68 2.6 3883.39 3 1994.45 1975.1 725.32 2736.3 1998 8998 6998 4998 2998 71217 8317 8611 891 81128 3 1 : 28.12.2 2 VS :4 28.1.5 3 28.7.14 9 1999-28 1 1 29 1 2 3 4 5 29 2 29 2 29 (8621)6138276

More information

Microsoft Word - 3635966_11153427.doc

Microsoft Word - 3635966_11153427.doc 马 钢 股 份 (600808) 马 钢 股 份 (0323.HK) 公 司 点 评 研 究 报 告 维 持 中 性 评 级 2012-3-29 分 析 师 : 刘 元 瑞 (8621) 68751760 liuyr@cjsc.com.cn 执 业 证 书 编 号 : S0490510120022 联 系 人 : 王 鹤 涛 (8621) 68751760 wanght1@cjsc.com.cn 财

More information

Sea of Japan Hokkaido Okhotsk Sea Study area Number of fish released (thousand) 120,000 100,000 80,000 60,000 40,000 20,000 0 1991 1993 1995 1997 1999 2001 Year Fish released in rivers Fish released from

More information

Microsoft Word - 01.DOC

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

More information

14 16 17 18 19 20 20 21 21 22 22 22 23 25 26 26 27 28 29 30 31 32 32 33 33 34 34

14 16 17 18 19 20 20 21 21 22 22 22 23 25 26 26 27 28 29 30 31 32 32 33 33 34 34 1 1 1 2 2 3 3 4 4 5 6 7 8 9 10 11 12 12 13 14 16 17 18 19 20 20 21 21 22 22 22 23 25 26 26 27 28 29 30 31 32 32 33 33 34 34 34 35 35 36 37 37 38 38 39 39 40 40 41 41 42 43 43 70% 75% 43 44 45 46 47 47

More information

1. 食 品 饮 料 本 周 观 点... 4 2. 食 品 饮 料 各 板 块 市 场 表 现... 7 3. 下 周 重 大 事 项... 12 4. 食 品 饮 料 公 司 盈 利 预 测 表... 13 请 务 必 仔 细 阅 读 正 文 之 后 的 各 项 信 息 披 露 与 声 明 第

1. 食 品 饮 料 本 周 观 点... 4 2. 食 品 饮 料 各 板 块 市 场 表 现... 7 3. 下 周 重 大 事 项... 12 4. 食 品 饮 料 公 司 盈 利 预 测 表... 13 请 务 必 仔 细 阅 读 正 文 之 后 的 各 项 信 息 披 露 与 声 明 第 / 行 业 及 产 业 食 品 饮 料 行 业 研 究 行 业 点 评 2016 年 07 月 11 日 茅 台 类 商 品 反 身 性 不 断 强 化 直 接 利 好 五 粮 液 看 好 食 品 饮 料 行 业 周 报 160704-160708 证 券 研 究 报 告 相 关 研 究 " 食 品 饮 料 行 业 周 报 160425-160429: 季 报 超 预 期 白 酒 将 是 全 年 投

More information

BOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2

BOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2 PowerBuilder 9 PowerBuilder Native Interface(PBNI) PowerBuilder 9 PowerBuilder C++ Java PowerBuilder 9 PBNI PowerBuilder Java C++ PowerBuilder NVO / PowerBuilder C/C++ PowerBuilder 9.0 PowerBuilder Native

More information

C语言的应用.PDF

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

More information

untitled

untitled 559 509 459 409 359 309 259 2008 10 30 14.31 20.60 295.61 300 1658.22 1719.81 5798.67 2012.50 080604 080826 300 1 2008.10.5 2, 2008.7.18 3 2008.7.14 (8621)61038287 zhangzj@gjzq.com.cn (8621)61038289 dongyaguang@gjzq.com.cn

More information

目 录 1. 表 现 回 顾 与 行 业 观 点...3 1.1. 行 业 表 现 :6 月 略 微 跑 输 大 市...3 1.2. 行 业 观 点 :2H 相 对 收 益 乐 观...4 2. 行 业 要 闻 与 公 司 动 态...5 2.1. 行 业 要 闻...5 2.2. 公 司 动 态

目 录 1. 表 现 回 顾 与 行 业 观 点...3 1.1. 行 业 表 现 :6 月 略 微 跑 输 大 市...3 1.2. 行 业 观 点 :2H 相 对 收 益 乐 观...4 2. 行 业 要 闻 与 公 司 动 态...5 2.1. 行 业 要 闻...5 2.2. 公 司 动 态 股 票 研 究 行 业 月 报 证 券 研 究 报 告 [Table_MainInfo] [Table_Title] 2012.07.02 2H 相 对 收 益 乐 观 国 泰 君 安 农 业 月 报 2012 年 7 月 秦 军 ( 分 析 师 ) 翟 羽 佳 ( 研 究 助 理 ) 傅 佳 琦 ( 分 析 师 ) 021-38676768 021-38674941 021-38674635 qinjun@gtjas.com

More information

报告的主线及研究的侧重点

报告的主线及研究的侧重点 26-11-2 862163299571 86213313733 zhouyong2@cjsc.com.cn zhoujt@cjsc.com.cn 27 7 7 25.1 6 25.12 26.5 26.11 2 2 6 7 27 7 7 ...1 2...1...2 6...3 7...4...5...7...8...11...11...13...15...18...18...18...19 7...2

More information

Microsoft Word - Daily150330-A.doc

Microsoft Word - Daily150330-A.doc 每 日 焦 点 中 银 国 际 证 券 研 究 报 告 指 数 表 现 收 盘 一 日 今 年 % 以 来 % 恒 生 指 数 24,486 (0.0) 3.7 恒 生 中 国 企 业 指 数 11,898 (0.2) (0.7) 恒 生 香 港 中 资 企 业 指 数 4,547 0.7 4.5 摩 根 士 丹 利 资 本 国 际 香 港 指 数 13,085 0.3 4.7 摩 根 士 丹 利

More information

“总结经验,以利再战”中国生物质能源产业综合报告

“总结经验,以利再战”中国生物质能源产业综合报告 总 结 经 验, 以 利 再 战 中 国 生 物 质 能 源 产 业 综 合 报 告 十 年 间, 以 农 业 废 弃 物 为 基 础 的 生 物 质 能 源 行 业 在 中 国 经 历 了 超 乎 想 象 的 发 展 过 程 初 期 的 飞 速 发 展, 众 多 投 资 商 纷 纷 涌 入 该 行 业 ; 经 历 了 数 年 稳 定 增 长 后, 今 天, 深 入 了 解 生 物 质 能 源 特

More information

untitled

untitled 26 5 5. % 1 4.75 4.5 4.25 4. 3.75 3.5 Apr-5 Jun-5 Aug-5 Oct-5 (%) Dec-5 Feb-6 Apr-6 : DataStream, April 25 to April 26 415% 22 6 ( ) 1 1 ( ) 1 ( ) 1 4261 4.8%2541.7% 4 419.6 4ISM 355.2 4 57.3 3 6.1%13

More information

出 版 : 會 員 通 訊 網 址 香 港 大 眾 攝 影 會 有 限 公 司 通 訊 地 址 : 香 港 郵 政 總 局 郵 箱 10657 號 非 賣 品 只 供 會 閱 覽 HONG KONG CAMERA CLUB, LT

出 版 : 會 員 通 訊 網 址  香 港 大 眾 攝 影 會 有 限 公 司 通 訊 地 址 : 香 港 郵 政 總 局 郵 箱 10657 號 非 賣 品 只 供 會 閱 覽 HONG KONG CAMERA CLUB, LT 香 港 大 眾 攝 影 會 有 限 公 司 HONG KONG CAMERA CLUB, LTD. 永 遠 榮 譽 會 長 胡 世 光 先 生 陳 海 先 生 任 霖 先 生 永 遠 名 譽 顧 問 簡 慶 福 先 生 連 登 良 先 生 黃 貴 權 醫 生 BBS 2012-13 年 度 本 年 度 榮 譽 會 長 譚 炳 森 先 生 王 健 材 先 生 陳 炳 洪 先 生 廖 群 先 生 翁 蓮

More information

<4D6963726F736F667420576F7264202D20CDA8D0C5C9E8B1B8D6C6D4ECD2B5A3A83230303630393031A3A9A3BACEF6D6F7C1F7C9E8B1B82E646F63>

<4D6963726F736F667420576F7264202D20CDA8D0C5C9E8B1B8D6C6D4ECD2B5A3A83230303630393031A3A9A3BACEF6D6F7C1F7C9E8B1B82E646F63> 行 业 研 究 析 主 流 设 备 商 2 季 财 报, 评 中 兴 通 讯 市 场 表 现 26/9/1 通 信 设 备 制 造 业 全 球 9 家 电 信 设 备 制 造 巨 头 占 据 了 约 9 的 市 场 份 额, 中 兴 通 讯 海 外 销 售 占 比 已 超 过 了 37%, 而 且 还 有 不 断 增 长 的 可 能 我 们 选 取 已 公 布 2 季 度 财 报 并 且 竞 争 领

More information

wedding calendar

wedding calendar W TAIPEI PRESENTS YOUR WEDDING YOUR WAY W SELECTED WEDDING DAY W JANUARY FEBRUARY MARCH APRIL 4 5 6 4 5 6 7 7 8 9 10 11 12 13 8 9 10 11 12 13 14 14 15 16 17 18 19 20 15 16 17 18 19 20 21 21 22 23 24 25

More information

目 录 索 引 一 事 件 描 述... 4 二 事 件 点 评... 4 1 全 年 行 业 景 气 走 弱 业 绩 增 长 趋 缓, 盈 利 能 力 逆 势 提 升... 4 2 内 并 外 扩 规 模 继 续 扩 张, 行 业 低 迷 中 市 占 率 提 升 尽 显 龙 头 本 色... 6

目 录 索 引 一 事 件 描 述... 4 二 事 件 点 评... 4 1 全 年 行 业 景 气 走 弱 业 绩 增 长 趋 缓, 盈 利 能 力 逆 势 提 升... 4 2 内 并 外 扩 规 模 继 续 扩 张, 行 业 低 迷 中 市 占 率 提 升 尽 显 龙 头 本 色... 6 Table_Excel1 213A Table_Contacter 海 螺 水 泥 (6585.SH) Tabl e_title 巩 固 国 内, 拓 展 海 外, 尽 显 龙 头 本 色 Table_Summary 报 告 期 内 公 司 实 现 营 业 收 入 67.6 亿 元, 同 比 增 长 9.95%; 归 属 净 利 润 19.9 亿 元, 同 比 增 长 17.19%, 同 比 增 长

More information

东吴证券研究所

东吴证券研究所 证 券 研 究 报 告 公 司 研 究 医 药 行 业 新 华 医 疗 (600587) 多 领 域 强 势 布 局, 将 厚 积 薄 发 增 持 ( 首 次 ) 投 资 要 点 制 药 设 备 体 系 建 成 + 市 场 回 暖 : 制 药 设 备 市 场 波 动 是 公 司 2015 年 利 润 下 降 的 主 要 原 因 公 司 制 药 设 备 板 块 已 形 成 中 药 和 生 物 药 设

More information

本 研 究 报 告 仅 通 过 邮 件 提 供 给 泰 信 基 金 管 理 有 限 公 司 泰 信 基 金 管 理 有 限 公 司 (research@ftfund.com) 使 用 2 投 资 案 件 投 资 评 级 与 估 值 6 个 月 目 标 价 26 元, 首 次 评 级 给 与 买 入

本 研 究 报 告 仅 通 过 邮 件 提 供 给 泰 信 基 金 管 理 有 限 公 司 泰 信 基 金 管 理 有 限 公 司 (research@ftfund.com) 使 用 2 投 资 案 件 投 资 评 级 与 估 值 6 个 月 目 标 价 26 元, 首 次 评 级 给 与 买 入 本 研 究 报 告 仅 通 过 邮 件 提 供 给 泰 信 基 金 管 理 有 限 公 司 泰 信 基 金 管 理 有 限 公 司 (research@ftfund.com) 使 用 1 上 市 公 司 公 司 研 究 / 深 度 研 究 证 券 研 究 报 告 中 小 股 票 2011 年 05 月 25 日 张 化 机 (002564) 订 单 饱 满, 下 半 年 募 投 产 能 释 放 带

More information

untitled

untitled 2017 1 16 2016 2017 2016 12 13 14 FOMC 25 2016 12 FOMC 25 2017 25 2017 5 2 16 2016 2017 12 2016 6 2016 11 2015 2016 2017 WMP 2016 27 13 11 50 2016 11 30 2016 2017 2017 2017 2016 2017 50 2 2017 2% 2017

More information