液晶之家论坛-

Size: px
Start display at page:

Download "液晶之家论坛-"

Transcription

1 10 C Sep.22, C [] page C Turbo C 2 C

2 C Turbo C C C / Turbo C Turbo C Turbo C PATH PATH=C:\TC;C:\DOS;... TC Turbo C PATH DOS TC Turbo C TC (Edit)(Compile)(Link)(Debug) (File)... CD C TC Del BS (C ) F3 F10 File Load Load File Name *.C *? TC Enter F2 F10 File Save F10 File Write to New Name _ Enter Turbo C TC (pass 1) (pass 2)(.exe) PC Ctrl + F9 F10 Run Run TC TC TC TC Alt + F5 F10 Run User screen TC 2

3 Turbo C Alt + X F10 File Quit Turbo C TC Verify NONAME.C not saved. Save? (Y/N) Y N 3

4 C C hello.c 1#include <stdio.h> 2main() 3{ 4 printf("hello!"); 5} Hello! #include <stdio.h> (prototype)(struct)(constant) C (declear) C INCLUDE\*.H #include <stdio.h> INCLUDE\stdio.h stdio.h (standard I/O) printf().h #include #include <> main() main() C int main() int main(int) void main(void), { } main() { } printf("hello!"); C (;) 4

5 C (space)(tab) mainprintf C printf() PrintF() printf printf() TC printf printf Ctrl + F1 Help Help TC Help printf: formatted output to stdout printf stdout int printf(const char *format,...); printf Prototype in stdio.h printf #include Print formats a variable number of arguments according to the format, and sends the output to stdout. Returns the number of bytes output. stdout In the event of error, it returns EOF. byte EOF See also ecvt fprintf putc puts scanf vprintf ecvt,fprintf,putc, puts,scanf,vprintf TC Ctrl + F1 TC Help printf int printf(const char *format,...); const char *format const format printf... format printf( "()", ); C (") %d %d 10 () %d 5

6 arith.c 1#include <stdio.h> 2void main(void) 3{ 4 printf("%d + %d = %d\n", 8, 2, 8+2 ); 5 printf("%d - %d = %d\n", 8, 2, 8-2 ); 6 printf("%d * %d = %d\n", 8, 2, 8*2 ); 7 printf("%d / %d = %d\n", 8, 2, 8/2 ); 8} = = 6 8 * 2 = 16 8 / 2 = 4 printf("%d + %d = %d\n", 8, 2, 8+2 ); () 3 %d 8, 2, = 10 () \n \n = = 68 * 2 = 168 / 2 = 4 C ============ ===================== ============== ========== ( ) * 4 * 2 8 / 4 / 2 2 ============ ===================== ============== ========== ============ ===================== ============== ========== ++ 1 i++ ++i i i-- --i i 1 % 4 % 2 0 ============ ===================== ============== ========== C ** 2 ** ^ 2 ^ 8 6

7 2 8 C C pow() pow( 2, 3 ) 2 3 C ( ) C [ ] { } ( )C ( * ( ) ) * 5-6 * 7 / = ( * ( 7 ) ) * 5-6 * 7 / = ( 15 ) * 5-6 * 7 / = / = = 62 (Comments) Keyin () C /* */ C /* */ /* */ " C++ //. comments.c or comments.cpp 1#include <stdio.h> /* prototype : printf() */ 2void main(void) // main program 3{ 4/* */ 5/* printf("%d + %d = %d\n", 8, 2, 8+2 ); */ 6/* printf("%d - %d = %d\n", 8, 2, 8-2 ); 7 printf("%d * %d = %d\n", 8, 2, 8*2 ); 8 printf("%d / %d = %d\n", 8, 2, 8/2 ); // division 9*/ 10} // end of program 7

8 (Nested Comments) nestcom0.c 1#include <stdio.h> /* prototype : printf() */ 2void main(void) 3{ 4/* */ 5/* 6 printf("%d + %d = %d\n", 8, 2, 8+2 ); 7/* printf("%d - %d = %d\n", 8, 2, 8-2 ); */ 8 printf("%d * %d = %d\n", 8, 2, 8*2 ); 9 printf("%d / %d = %d\n", 8, 2, 8/2 ); 10*/ 11} /* */ Compile 5 /* 10 */ /* 7 */ 7 Turbo C 5 /* 7 */ 10 */ Compile F10 Options Compiler Source Nested comments Off Off On nestcom1.c printf(); nestcom2.c printf(); /* */ nestcom3.c /* */ nestcom1.c 1#include <stdio.h> /* prototype : printf() */ 2void main(void) 3{ 4 /* */ 5 6 printf("%d + %d = %d\n", 8, 2, 8+2 ); /* = 10 */ 7 printf("%d - %d = %d\n", 8, 2, 8-2 ); /* 8-2 = 6 */ 8 printf("%d * %d = %d\n", 8, 2, 8*2 ); /* 8 * 2 = 16 */ 9 printf("%d / %d = %d\n", 8, 2, 8/2 ); /* 8 / 2 = 4 */ 10 11} 8

9 nestcom2.c 1#include <stdio.h> /* prototype : printf() */ 2void main(void) 3{ 4/* */ 5 6/* printf("%d + %d = %d\n", 8, 2, 8+2 ); */ /* = 10 */ 7/* printf("%d - %d = %d\n", 8, 2, 8-2 ); */ /* 8-2 = 6 */ 8/* printf("%d * %d = %d\n", 8, 2, 8*2 ); */ /* 8 * 2 = 16 */ 9/* printf("%d / %d = %d\n", 8, 2, 8/2 ); */ /* 8 / 2 = 4 */ 10 11} nestcom3.c 1#include <stdio.h> /* prototype : printf() */ 2void main(void) 3{ 4/* */ 5/* 6 printf("%d + %d = %d\n", 8, 2, 8+2 ); /* = 10 */ 7 printf("%d - %d = %d\n", 8, 2, 8-2 ); /* 8-2 = 6 */ 8 printf("%d * %d = %d\n", 8, 2, 8*2 ); /* 8 * 2 = 16 */ 9 printf("%d / %d = %d\n", 8, 2, 8/2 ); /* 8 / 2 = 4 */ 10*/ 11} 9

10 C (constant)(variable) 0,1, type Char, int, long, float, double etc. C (A Z a z)( _ ) TC if switch else for default case do break while continue goto return char int long float double void register signed unsigned short near far huge typedef struct union enum auto const static volatile extern interrupt cdecl pascal asm sizeof _AX _AH _AL _cs _CS _BX _BH _BL _ds _DS _CX _CH _CL _es _ES _DX _DH _DL _ss _SS _SI _DI _BP _SP (float) C 1 [, 2 [,...]] ; int NumberOfStudent; /* */ long MoneyInBank, interest; /* */ 10

11 float RateOfInterest; /* */ char EndOfString; /* */ char OneStudentName[9]; /* */ (initial value) 1= 1 [, 2= 2 [,...]] ; int NumberOfStudent=60; /* */ long MoneyInBank= L; /* */ float RateOfInterest=5.0; /* in % */ char EndOfString='\0'; /* */ char OneStudentName[9]=""; /* */ L C TC TC TC L L char byte ' 'A' 'a' '0' '\101''\141''\60' '\0' '\x41''\x61''\x30''\x0' '\0' "123""ABC""abc" 4 bytes strlen() ( '\0' ) int StringLen=strlen("123"); StringLen 3 strlen() #include <string.h> = = (); C = C == 11

12 PI = ; r = 4; area = PI * r * r ; var.c #include <stdio.h> void main(void) { int i,j; i = 10; j = 2; printf("%d + %d = %d\n", i, j, i+j ); printf("%d - %d = %d\n", i, j, i-j ); printf("%d * %d = %d\n", i, j, i*j ); printf("%d / %d = %d\n", i, j, i/j ); i = 20; j = 2; printf("%d + %d = %d\n", i, j, i+j ); printf("%d - %d = %d\n", i, j, i-j ); printf("%d * %d = %d\n", i, j, i*j ); printf("%d / %d = %d\n", i, j, i/j ); } = = 8 10 * 2 = / 2 = = = * 2 = / 2 = 10 : (Global Variable): (Local Variable): (Static Variable): 12

13 printf() printf printf printf : printf("", 1, 2,... ); % \ % % % printf %c %d %ld %f %lf %Lf %s \ '\x41' A C Dec Hex \n 10 0x0A \t 9 0x09(1+8n) \b 8 0x08 \a 7 0x07 \r 13 0x0D \f 12 0x0C \\ 92 0x5C \ \' 39 0x27 ' \" 34 0x22 " \xhh 0xHH 0xHH *%% 37 0x25 % % 13

14 printf % %5d 5 %12ld 12 printf %8.3f ( ) = 4 printf printf %-5d 5 5 (int)(long) % - + w d int % - + w ld long w (float)(double)(long double) % - + w. p f float % - + w. p lf double % - + w. p Lf long double p 6 w print.c 1#include <stdio.h> 2void main(void) 3{ 4 printf(" %ld \n", ); 5 printf(" %5ld \n", ); 6 printf(" %d \n", 123 ); 7 printf(" %5d \n", 123 ); 8 printf(" %-5d \n", 123 ); 14

15 9 printf(" %f \n", ); 10 printf(" %9f \n", ); 11 printf(" %9.2f \n", ); 12 printf(" %-9.2f \n", ); 13} , %ld TC TC scanf() C scanf keyboard scanf scanf("", & 1, & 2,... ); scanf printf scanf printf scanf %c %d %ld *%D %f %lf %Lf %s %F %D scanf() printf() scanf (pointer) i C &i &i i i () char c; /* */ /* c &c */ int i; /* */ /* i &i */ long l; /* */ /* l &l */ float f; /* */ /* f &f */ double d; /* */ /* d &d */ long double ld; /* */ /* ld &ld */ 15

16 char str[80]; /* () */ /* str[80] str */ int a[100]; /* */ /* a[100] a */ long b[100]; /* */ /* b[100] b */ float c[100]; /* */ /* c[100] c */ var.c scanf io.c 1#include <stdio.h> 2void main(void) 3{ 4 int i,j; 5 6 printf("enter 2 integers:"); 7 scanf("%d %d", &i, &j ); /* i j &i,&j */ 8 printf("now, I find that...\n"); 9 printf("%d + %d = %d\n", i, j, i+j ); 10 printf("%d - %d = %d\n", i, j, i-j ); 11 printf("%d * %d = %d\n", i, j, i*j ); 12 printf("%d / %d = %d\n", i, j, i/j ); 13} Enter 2 integers:20 4 i = 20, j = 4 Now, I find that = = * 4 = / 4 = 5 scanf ((tab)) scanf i j Enter scanf scanf gets() gets gets atoi() atol() atof() ()() f2c.c 1#include <stdio.h> 2void main(void) 3{ 4 int f,c; 5 6 printf("enter the temperature in F : "); 16

17 7 scanf("%d", &f ); /* f &f */ 8 c = ( f - 32 ) * 5 / 9 ; /* */ 9 printf("%d degrees in F is %d degrees in C.", f, c); 10} Enter the temperature in F : degrees in F is 37 degrees in C. ()() C = ( F - 32 ) * 5 / 9 F = C * 9 / "" age.c 1#include <stdio.h> 2void main(void) 3{ 4 float years, days; 5 6 printf("enter the age of you : "); 7 8 scanf("%f", &years ); days = years * ; /* years &years */ /* */ 9 printf("you are %f days old.", days ); 10} Enter the age of you : 28.5 You are days old. getche() scanf() Enter Enter getche() getche ch = getche(); getche() ch getche() ASCII code.c 1#include <stdio.h> /* printf() */ 2#include <conio.h> /* getche() */ 3void main(void) 4{ 5 char ch; 6 17

18 7 ch = getche(); /* getche() */ 8 printf(" -- You typed %c.\n", ch ); 9 printf("character %c has ASCII code %d.\n", ch, ch ); 10} A -- You typed A. Character A has ASCII code 65. ASCII 9 %c ch %d ch 10 Help Help printf: formatted output to stdout stdout int printf(const char *format,...); printf Prototype in stdio.h #include<stdio.h> Print formats a variable number of arguments according to the format, and sends the output to stdout. Returns the number of bytes output. stdout In the event of error, it returns EOF. byte EOF See also ecvt fprintf putc puts scanf vprintf Help Format Specifiers format % [flags] [width] [.prec] [F N h l] type [ ] type Format of Output d signed decimal int d i signed decimal int i o unsigned octal int o u unsigned decimal int u x in printf = unsigned hexdecimal int x 16 () lowercase; in scanf = hexadecimal int scanf 16 X in printf = unsigned hexdecimal int X 16 () uppercase; in scanf = hexadecimal long scanf 16 f floating point [-]dddd.ddd f e floating point [-]d.ddd e [+/-]ddd e e2 g format e or f based on precision g f e E same as e except E for exponent E e E 18

19 G same as g except E for exponent G g E c single character c s print characters till '\0' or [.prec] s '\0' % the % character % % p pointer: near - YYYY; far - XXXX:YYYY p YYYY XXXX:YYYY n stores count of characters written so n far in the location pointed to by input argument [flag] What it Specifies [] none right-justify, pad 0 or blank to left 0 - left-justify, pad spaces to right - + always begin with + or - + blank print sign for negative values only # convert using alternate form: # c,s,d,i,u no effect c,s,d,i,u o 0 prepended to nonzero arg o 0 0 x or X 0x or 0X prepended to arg x,x 0x 0X e, E, f always use decimal point e,e,f g or G same as above but no g,g 0 trailing zeros [width] Effect on Output [] n at least n characters, blank-padded n 0n at least n characters, 0 left fill 0n 0 * next argument from list is width * [.prec] Effect on Output [.] none default precision.0 d,i,o,u,x default precision.0 d,i,o,u,x e, E, f no decimal point e,e,f.n at most n characters.n n * next argument from list is precision.* Modifier How arg is Interpreted F arg is far pointer F N arg is near pointer N h d,i,o,u,x,x arg is short int h l d,i,o,u,x,x arg is long int l l e, E, f, g, G arg is double l ( scanf) (scanf only) L e,e,f,g,g arg is long double L 19

20 Help scanf: performs formatted input from stdin stdin int scanf(const char *format,...); scanf Prototype in stdio.h #include<stdio.h> Returns the number of input fields processed successfully. It processes input according to the format and places the results in the memory locations pointed to by the arguments. See also atof cscanf fscanf getc printf sscanf vfscanf vscanf vsscanf Help getch: gets character from console, no echoing getche: gets character from the console and echoes to screen int getch(void); getch int getche(void); getche Prototype in conio.h #include<conio.h> Both functions return the character read. getch getche Characters are available immediately - no buffering of whole lines. Special keys such as function keys and arrow keys are represented by a two character sequence: a zero character followed by the 0 scan code for the key pressed. See also getpass cgets cscanf kbhit ungetch putch getchar getc 20

21 scanf ( Garbage In, Garbage Out ) C ( Flow Chart ) 6 21 a, b, c a, b, c a, b, c a,b,c F = 100; C =(F-32)*5/9;

22 a>=b No No Yes Yes Yes No c=0; c=5; a b Yes No c=5; c=0; scanf("%d %d", &a,&b); a>=b No Yes a>=b No Yes b>=c No Yes c=1; a>=b No 22 Yes

23 a b a b a b a b a b C > a>b a b < a<b a b >= a>=b a b <= a<=b a b == a==b a b!= a!=b a b 23

24 (True) (False) C (False) 0 0 C (True) C = == a = 3 ; a 3 a == 3 a 3 a 3 if if No if Yes if() { } () { } C ( 0,1,...) { } ; { i = i + 1; i = i + 1; } { i = i - 1; j = i * 2; } ( ; ) abs.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 24

25 4 int i; 5 6 printf("enter an integer:"); 7 scanf("%d",&i); 8 if( i < 0 ) i = -i; 9 printf("the absolute value of it is %d.\n", i ); 10} Enter an integer:-100 The absolute value of it is 100. i, i >= 0 i -i, i < 0 8 i < 0 i = -i i if - else if else No Yes if-else 2 1 if() { 1 } else { 2 } () { 1 } { 2 } max1.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 int i, j, max; 5 6 printf("enter 2 integer :"); 7 scanf("%d %d", &i, &j); 8 if( i > j ) max = i; 9 else max = j; 10 printf("the maximum of %d and %d is %d.\n", i, j, max ); 11} Enter 2 integer : 7 5 The maximum of 7 and 5 is 7. 25

26 if-else if if-else C else if-else else if-else if-else if if( 1) { 1 } else if( 2) { 2 } else if( 3) { 3 } else if... else { n } ( 1) { 1 }; ( 2) { 2 }; ( 3) { 3 };... { n } No Yes 1 No Yes 2 No Yes... 3 No Yes... n 26

27 police.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 int speed; 5 6 printf("enter the speed = "); 7 scanf("%d", &speed ); 8 if( speed < 60 ) 9 printf("too slow, speed up!\n"); 10 else if( speed < 90 ) 11 printf("good day, boss.\n"); 12 else if( speed < 100 ) 13 printf("too fast, slow down!\n"); 14 else 15 printf("i will give you a ticket!\n"); 16} Enter the speed = 50 Too slow, speed up! Enter the speed = 80 Good day, boss. Enter the speed = 95 Too fast, slow down! Enter the speed = 120 I will give you a ticket! if( speed < 100 ) printf("too fast, slow down!\n"); else if( speed < 90 ) printf("good day, boss.\n"); else if( speed < 60 ) printf("too slow, speed up!\n"); else printf("i will give you a ticket!\n"); speed < 100 Too fast, slow down! speed >= 100 I will give you a ticket! 27

28 No No 90 Yes 90 No Yes 100 Yes calc.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 float num1,num2; 5 char op; 6 7 for(;;) 8 { 9 printf("enter number, operator, number\n"); 10 scanf("%f %c %f", &num1, &op, &num2); 11 if( op == '+' ) 12 printf("%f + %f = %f\n", num1, num2, num1+num2); 13 else if( op == '-' ) 14 printf("%f + %f = %f\n", num1, num2, num1-num2); 15 else if( op == '*' ) 16 printf("%f + %f = %f\n", num1, num2, num1*num2); 17 else if( op == '/' ) 28

29 18 printf("%f + %f = %f\n", num1, num2, num1/num2); 19 } 20} Enter number, operator, number = Enter number, operator, number 5 * = ^C + - * / 7 Ctrl + Break Ctrl + C C && AND exp1 && exp2 exp1 exp2 OR! exp1 exp2 exp1 exp2 exp1 exp2 NOT!exp1 exp1 exp1 ( sum = ) 8 ( ( sum = ) <= 10 ) ( 8 <= 10 ) (,) ( i = 1, j = 2, k = i + j ) k 3 i = 1 j = 2 k = i + j k 3 k = i + j k 3 29

30 yes.c 1#include <stdio.h> /* printf() */ 2#include <conio.h> /* getche() */ 3void main(void) 4{ 5 char ch; 6 7 printf("press Y or y to continue xxxxxx..."); 8 if ( ( ch = getche() ) == 'Y' ch == 'y' ) 9 printf("\nyou press %c.\n", ch), 10 printf("continue xxxxxx...\n"); 11 else 12 printf("\nyou press %c.\n", ch), 13 printf("stop xxxxxx!\n"); 14} Press Y or y to continue xxxxxx...y You press y. continue xxxxxx... Press Y or y to continue xxxxxx...q You press q. stop xxxxxx! Y y You press y. continue xxxxxx... Y y You press X. stop xxxxxx! 8 if ( ( ch = getche() ) == 'Y' ch == 'y' ) ch ch if ( ch == 'Y' ch == 'y' ) ch 'Y ' 'y' 9 printf("\nyou press %c.\n", ch), (, ) ( ; ) 10 ( ; ) ( ; ) 9 10 { } { printf("\nyou press %c.\n", ch); printf("continue xxxxxx...\n"); } if 12 30

31 yes2.c 1#include <stdio.h> /* printf() */ 2#include <conio.h> /* getche() */ 3void main(void) 4{ 5 char ch; 6 7 printf("press Y or y to continue xxxxxx..."); 8 ch = getche(); 9 if ( ch == 'Y' ch == 'y' ) 10 { 11 printf("\nyou press %c.\n", ch); 12 printf("continue xxxxxx...\n"); 13 } 14 else 15 { 16 printf("\nyou press %c.\n", ch); 17 printf("stop xxxxxx!\n"); 18 } 19} Compile.exe TC Compile.exe (Debug Information) yes.c yes2.c TC tcc yes.c yes2.c DOS_Prompt> tcc yes.c DOS_Prompt> tcc yes2.c yes.exe yes2.exe 31

32 for C for for for for ( ; ; ) { } for for { } 3. { } 2 for for for ( i = 0 ; i < 100 ; i = i+1 ) printf("i = %3d\n", i ); for ( i = 0, j = 0 ; i < 100 ; i = i+1, j = j+2 ) printf("i = %3d j = %3d\n", i, j ); 32

33 for for ( ; ; ) { } for { } 3. { } 2 for for for ( ; ; ) { } for for { } (delay) ( ; ) for ( ; ) ASCII ascii.c 33

34 1#include <stdio.h> /* printf() */ 2void main(void) 3{ 4 int i; 5 6 for( i = 32 ; i < 256 ; i = i+1 ) 7 printf("%3d=%c\t", i, i ); 8} 32= 33=! 34=" 35=# 36=$ 37=% 38=& 39='... 42=* 43=+ 44=, 45=- 46=. 47=/ 48=0 49= =4 53=5 54=6 55=7 56=8 57=9 58=: 59=; =* 253=* 254=* 255= for( i = 32 ; i < 256 ; i = i+1 ) ======== ======== ========= C i = i + 1 i++ i-- i = i i += 2 i = i + 2 i -= 2 i = i - 2 += -= i *= 2 i = i * 2 i /= 2 i = i / 2 n! n!.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 long fact; 5 int n; 6 7 printf("enter the value of n to compute n! : "); 8 9 scanf("%d", &n ); printf("%d! = %d", n, n ); 10 fact = n; 11 for( n = n-1 ; n >0 ; n-- ) 12 { 13 fact *= n; 14 printf("x%d", n); 15 } 16 printf(" = %ld", fact); 17} Enter the value of n to compute n! : 5 n! = 5x4x3x2x1 = 120 n n! = n * (n-1) * (n-2) *... * 2 * 1 fact n 5 9 n 5 10 fact = n; fact = 5 n n-1 4 n n-1 34

35 13 fact *= n fact = fact * n n 1 fact n fact n 5 5 5! = 5 n 5 4 5! = 5 1 5*4 4 5! = 5x4 2 5*4*3 3 5! = 5x4x3 3 5*4*3*2 2 5! = 5x4x3x2 4 5*4*3*2*1 1 5! = 5x4x3x2x1 5*4*3*2*1 1 5! = 5x4x3x2x1 = 120 for for for for (nest) ;... for(... ;... ;... ) { ;... for(... ;... ;... ) { ;... } ;... } if for(...;...;...) { for(...;...;...) {... }... for(...;...;...) { 35

36 ... } } for(...;...;...) { for(...;...;...) {... for(...;...;...) {... } }... } 99.c 1#include <stdio.h> /* printf() */ 2void main(void) 3{ 4 int i, j; 5 6 for( i=1 ; i<=9 ; i++ ) 7 { 8 for( j=1 ; j<=9 ; j++ ) 9 printf("%dx%d=%2d ", j, i, j*i ); 10 printf("\n"); 11 } 12} 1x1= 1 2x1= 2 3x1= 3 4x1= 4 5x1= 5 6x1= 6 7x1= 7 8x1= 8 9x1= 9 1x2= 2 2x2= 4 3x2= 6 4x2= 8 5x2=10 6x2=12 7x2=14 8x2=16 9x2=18 1x3= 3 2x3= 6 3x3= 9 4x3=12 5x3=15 6x3=18 7x3=21 8x3=24 9x3=27 1x4= 4 2x4= 8 3x4=12 4x4=16 5x4=20 6x4=24 7x4=28 8x4=32 9x4=36 1x5= 5 2x5=10 3x5=15 4x5=20 5x5=25 6x5=30 7x5=35 8x5=40 9x5=45 1x6= 6 2x6=12 3x6=18 4x6=24 5x6=30 6x6=36 7x6=42 8x6=48 9x6=54 1x7= 7 2x7=14 3x7=21 4x7=28 5x7=35 6x7=42 7x7=49 8x7=56 9x7=63 1x8= 8 2x8=16 3x8=24 4x8=32 5x8=40 6x8=48 7x8=56 8x8=64 9x8=72 1x9= 9 2x9=18 3x9=27 4x9=36 5x9=45 6x9=54 7x9=63 8x9=72 9x9=

37 i=1 1 9 i= printf("%dx%d=%2d ", j, i, j*i ); i j printf("\n"); break break break break break for(...;...;...) /* */ { for(...;...;...) /* */ {... if(...) break; /* */... } /* */... if(...) break; /* */... } /* */ Ctrl + C Ctrl + Break Ctrl + C Ctrl + Break Ctrl + C Ctrl + Break q x Ctrl + C Ctrl + Break for C while do... while while while while ( ) { } while 1. { } 2.{ } 1 37

38 while while for while( i < 10 ) for( ; i<10 ; ) { { } } do... while do... while do { } while ( ); do... while 1.{ } 2. { } 3.{ } 2 do... while 38

39 while do... while while do... while 39

40 50 50 []; 50 int score[50]; C 0 50 score[0], score[1], score[2],..., score[48], score[49] temper.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 int t[7]; 5 int day, sum; 6 7 for( day = 0 ; day < 7 ; day++ ) 8 { 9 printf("enter the temperature for day %d : ", day+1 ); 10 scanf("%d", &t[day]); 11 } sum = 0; 14 for( day = 0 ; day < 7 ; day++ ) 15 sum = sum + t[day]; printf("average temperature = %f\n", sum/7. ); 18} Enter the temperature for day 1 : 22 Enter the temperature for day 2 : 20 Enter the temperature for day 3 : 18 Enter the temperature for day 4 : 19 Enter the temperature for day 5 : 23 Enter the temperature for day 6 : 24 Enter the temperature for day 7 : 26 Average temperature =

41 &t[0] t[0] t + 0 ( 1000 )h &t[1] t[1] t + 1 ( 1002 )h &t[2] t[2] t + 2 ( 1004 )h &t[3] t[3] t + 3 ( 1006 )h &t[4] t[4] t + 4 ( 1008 )h &t[5] t[5] t + 5 ( 100A )h &t[6] t[6] t + 6 ( 100C )h 10 scanf("%d", &t[day]); &t[day] day 0 6 scanf("%d", t+day ); t (constant pointer) t + day day t t ( 1000 )h t + 1 ( 1001 )h C t + 1 t TC2 2 bytes t + 1 ( 1002 )h ( 1001 )h t + 2 ( 1004 )h 17 printf("average temperature = %f\n", sum/7. ); sum/7. 7 (. ) Keyin sum sum/7 sum/7. %f '\0' DOS DOS 8 3 (. ) = 12 '\0' = 13 char filename[13]; printf("enter the file name : "); scanf("%12s", filename ); scanf filename[13] filename &filename[0] %12s 12 '\0' 12 %s 13 41

42 string.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 char name[13]; 5 6 printf("enter your name please : "); 7 scanf("%12s", name ); 8 printf("good day, Mr. %s.", name ); 9} Enter your name please : Lee Good day, Mr. Lee. 7 %12s %s C [][]; [][][]; int score[50]; int score[50][7]; () demo.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 char matrix[5][10]; 5 int x,y; 6 7 for( y=0 ; y<5 ; y++ ) /* */ 8 for( x=0 ; x<10 ; x++) 9 matrix[y][x] = '.' ; printf("enter the coordinate(0 0) - (9 4) : "); 12 scanf("%d %d", &x, &y ); /* */ for( ;!( ( x>=0 x<=9 ) && ( y>=0 y<=4 ) ) ; ) 15 { 16 printf("\ainvalid Value!!\n"); 17 printf("please enter the coordinate(0 0) - (9 4) : "); 42

43 18 scanf("%d %d", &x, &y ); /* */ 19 } 20 matrix[y][x] = '*' ; /* */ for( y=0 ; y<5 ; y++ ) /* */ 23 { 24 for( x=0 ; x<10 ; x++) 25 printf("%c", matrix[y][x] ); 26 printf("\n"); 27 } 28} Enter the coordinate(0 0) - (9 4) : *... 0 * 6, for C int s[50][3]; &s[0][0] s[0][0] *(s + 0) + 0 s + 0 s ( 1000 )h &s[0][1] s[0][1] *(s + 0) + 1 ( 1002 )h &s[0][2] s[0][2] *(s + 0) + 2 ( 1004 )h &s[1][0] s[1][0] *(s + 1) + 0 s + 1 ( 1006 )h &s[1][1] s[1][1] *(s + 1) + 1 ( 1008 )h &s[1][2] s[1][2] *(s + 1) + 2 ( 100A )h &s[2][0] s[2][0] *(s + 2) + 0 s + 2 ( 100C )h &s[48][2] s[48][2] *(s +48) + 2 (30h*3+2)*2 ( 1124 )h &s[49][0] s[49][0] *(s +49) + 0 s +49 ( 1126 )h &s[49][1] s[49][1] *(s +49) + 1 ( 1128 )h &s[49][2] s[49][2] *(s +49) + 2 ( 112A )h 43

44 s ( * ) n byte n vartype Array[ X ][ Y ]; vartype n byte Array Y * n Y vartype Array &Array[0][0] Array+1 &Array[1][0] Array+i &Array[i][0] *Array *(Array+1)...*(Array+i)... *(Array+(X-1)) 0 i (X-1) Array[X][Y] (X)(Offset) *(Array+i)...*(Array+i)+j...*(Array+i)+(Y-1) 0 j (Y-1) Array[X][Y] (Y)(Offset) *(Array + i) + j Array[i][j] *( *(Array + i) + j ) Array[i][j] C (Boundary) int s[50][7]; s[0][8]s[51][2] s[100][200] demoptr.c 1#include <stdio.h> /* printf(),scanf() */ 2void main(void) 3{ 4 char matrix[5][10]; 5 int i,x,y; 6 7 for( i=0 ; i<5*10 ; i++ ) /* */ 8 *((*matrix)+i) = '.' ; 9 10 printf("enter the coordinate(0 0) - (9 4) : "); 11 scanf("%d %d", &x, &y ); /* */ for( ;!( ( x>=0 x<=9 ) && ( y>=0 y<=4 ) ) ; ) 14 { 15 printf("\ainvalid Value!!\n"); 16 printf("please enter the coordinate(0 0) - (9 4) : "); 17 scanf("%d %d", &x, &y ); /* */ 18 } 19 matrix[y][x] = '*' ; /* */ for( y=0 ; y<5 ; y++ ) /* */ 22 { 23 for( x=0 ; x<10 ; x++) 44

45 24 printf("%c", *( *(matrix + y) + x) ); 25 printf("\n"); 26 } 27} 45

46 C (Function)(Routine) sin sin: sine function double sin(double x); sin Prototype in math.h #include<math.h> x is in radians. x (rad) Returns a value in the range -1 to A = sin( M_PI/2 ); sin(/2)=1.0 A=1.0; sin() (rad) sine x sin() sin(x) (rad) C pow( X, Y) X Y pow: power function, x to the y X Y double pow(double x, double y); pow Prototype in math.h #include<math.h> routine... printf() scanf() main() main() (sub-routine) ( 1, 2,...) { } ( 1, 2,...) { } C return(); 46

47 () C void void void ( 1, 2,...) {... } void ( void ) {... } C #include <stdio.h> stdio.h printf() scanf() (prototype) main() main() beep.c 1#include <stdio.h> /* printf() */ 2#include <conio.h> /* getche() */ 3 4void beep(void) /* beep() */ 5{ /* beep() */ 6 printf("\a"); /* */ 7} /* beep() */ 8 9void main(void) /* main() */ 10{ /* main() */ 11 beep(); /* beep() */ 12 printf("press any key to continue..."); /* printf() */ 13 getche(); /* getche() */ 14 beep(); /* beep() */ 15} /* main() */ Press any key to continue... 47

48 void getche() beep() printf() byte bar.c 1#include <stdio.h> /* printf() */ 2 3void bar(int i) /* bar() */ 4{ /* bar() */ 5 int j; 6 7 for( j=0 ; j<i ; j++) /* i */ 8 printf("*"); 9 printf("\n"); 10} /* bar() */ 11 12void main(void) 13{ 14 printf("merry\t"); 15 bar(30); /* 30 */ 16 printf("john\t"); 17 bar(40); /* 40 */ 18 printf("johnson\t"); 19 bar(20); /* 20 */ 20 printf("sposh\t"); 21 bar(50); /* 50 */ 22} Merry ****************************** John **************************************** Johnson ******************** Sposh ************************************************** bar() bar(i) int i; /* */ {... } C TC bar(30); 30 i =

49 area.c 1#include <stdio.h> /* printf(), scanf() */ 2 3float areas(float r) 4{ /* 2 */ 5 return( * r * r ); /* = */ 6} 7 8void main(void) 9{ 10 float radius; printf("enter the radius = "); 13 scanf("%f", &radius); 14 printf("area of this circle = %f\n", areas( radius ) ); 15} Enter the radius = 6 Area of this circle = areas( radius ) radius areas() areas() float areas( radius ) radius r1 r2 totalarea = areas( r1 ) + areas( r2 ) ; max.c 1#include <stdio.h> /* printf(), scanf() */ 2 3int max(int i, int j) 4{ 5 if( i > j ) return i; /* i > j i */ 6 else return j; /* j j */ 7} 8 9void main(void) 10{ 11 int i, j; printf("enter 2 integers : "); 14 scanf("%d %d", &i, &j); 15 printf("maximum of %d and %d is %d.\n", i, j, max(i,j) ); 16} Enter 2 integers : 6 8 Maximum of 6 and 8 is 8. 49

50 TC2 max() TC max max Ctrl+F1 Help Macros: max, min max, min These macros generate inline code to find the maximum or minimum value of two integers. max(a,b) maximum of two integers a and b a,b min(a,b) minimum of two integers a and b a,b Defined in stdlib.h #include<stdlib.h> max() stdlib.h max1.c 1#include <stdio.h> /* printf(), scanf() */ 2#include <stdlib.h> /* max() */ 3 4void main(void) 5{ 6 int i, j; 7 8 printf("enter 2 integers : "); 9 scanf("%d %d", &i, &j); 10 printf("maximum of %d and %d is %d.\n", i, j, max(i,j) ); 11} Enter 2 integers : 6 8 Maximum of 6 and 8 is 8. TC #include??.h (Global Variable) C (Local Variable) void sub1(void) { int i; i 50

51 ... } i {... } TC2.0 { } bar.c bar2.c 1#include <stdio.h> /* printf() */ 2 3void bar(int i) 4{ /* bar() */ 5 int j; 6 for( j=0 ; j<i ; j++) printf("*"); /* i */ 7 printf("\n"); 8} /* bar() */ 9 10void main(void) 11{ 12 int i = 50; 13 bar(i); /* i 50 */ 14 { i 15 int i = 20; 16 bar(i); /* i 20 */ i 17 i = i + 10; 18 bar(i); /* i 30 */ 19 } 20 i = i + 10; 21 bar(i); /* i 60 */ 22} ************************************************** ******************** ****************************** ************************************************************ i i main() i i i i i i 15 remark 51

52 #include<...> int i; void sub1(int a) { int j;... } void sub2( b ) int b; { int k;... } void main(void) { int c;... } Call by Value v.s. Call by Address Call by Value bar() bar3.c 1#include <stdio.h> /* printf() */ 2 3void bar(int i) 4{ 5 for( ; i>0 ; i-- ) /* i 0 */ 6 printf("*"); 7 printf("\n"); 8} 9 10void main(void) 11{ 12 int i = 50; 13 int j = 30; bar( 20 ); /* 20 bar() */ bar( j ); /* j 30 bar() */ 18 printf("j = %d\n", j ); /* j */ bar( i ); /* i 50 bar() */ 21 printf("i = %d\n", i ); /* i */ 22} 52

53 ******************** ****************************** j = 30 ************************************************** i = 50 bar(20); 20 bar() i bar() void bar(...) { int i = 20; 20 for( ; i>0 ; i-- ) printf("*"); printf("\n"); } i bar(j); j 30 bar() i bar() void bar(...) { int i = 30; j 30 for( ; i>0 ; i-- ) printf("*"); printf("\n"); } i bar(i); i 50 bar() i bar() void bar(...) { int i = 50; i 50 for( ; i>0 ; i-- ) printf("*"); printf("\n"); } i Call by Address scanf() scanf("", & 1, & 2,... ); scanf() scanf() 53

54 scanf() scanf() scanf() swap.c 1#include <stdio.h> /* printf() */ 2 3void swap(int *a, int *b) 4{ 5 int backup = *a ; /* *a backup */ 6 *a = *b ; /* *b *a */ 7 *b = backup ; /* backup *b */ 8} 9 10void main(void) 11{ 12 int i = 50, j = 30 ; printf("before swap(): i = %d j = %d\n", i, j); printf("swapping i & j...\n"); 17 swap( &i, &j ); /* i j */ printf("after swap(): i = %d j = %d\n", i, j); 20} Before swap(): i = 50 j = 30 Swapping i & j... After swap(): i = 30 j = 50 54

55 PEII DOS WORD (FAT,File Allocation Table)(Lost Chain) (Cross Link) fopen FILE *fp; fp=fopen("",""); fp FILE FILE C FILE *fp; fp C fopen() "" "" r w a r+ / w+ / a+ b 55

56 fp1 = fopen("letter.txt","w"); fp2 = fopen("c:\\work\\test.txt","a+"); fp3 = fopen("score.dat","r"); fp4 = fopen("database.dat","w+b"); fclose fclose( ); fclose( fp ); fprintf fprintf( fp, "", 1, 2,...); fprintf() printf() fprintf() printf() record.c 1#include <stdio.h> /* printf, scanf, fopen,fprintf...*/ 2#include <string.h> /* strcmp() */ 3 4void line(file *fp) /* */ 5{ 6 int i; 7 for( i=0 ; i<60 ; i++ ) 8 fprintf( fp, "-" ); 9 fprintf( fp, "\n" ); 10} 11 12void main(void) 13{ 14 FILE *fp; /* */ 15 char filename[20]; /* */ 16 char client[40]; /* */ 17 float amount; /* */ 18 float total=0; /* */ printf("file to record the amount : "); 21 scanf("%19s", filename ); /* */ 22 fp = fopen( filename, "w"); /* */ 23 if( fp == NULL ) /* */ 24 printf("\acannot open %s for output!\n",filename); 25 else 26 { /* */ 27 line( fp ); 28 printf("client : "); 29 scanf("%39s", client); 56

57 30 for( ; strcmp(client, "end")!= 0 ; ) /* clinet=="end" */ 31 { /* */ 32 printf("amount = "); 33 scanf("%f", &amount); 34 total = total + amount ; 35 fprintf( fp, "%-40s $%f\n", client, amount); printf("client : "); 38 scanf("%39s", client); 39 } 40 line( fp ); 41 fprintf( fp, "%-40s $%f\n", "***** Total", total ); 42 line( fp ); 43 } 44 fclose(fp); /* */ 45} File to record the amount : test Client : Nanya_College Amount = Client : ABC_Company Amount = Client : IJK_lmn_... Amount = Client : Xyz... Amount = Client : zzzzzz Amount = Client : end test Nanya_College $ ABC_Company $ IJK_lmn_... $ Xyz... $ zzzzzz $ ***** Total $ scanf() scanf() scanf() ) 30 strcmp(client, "end")!= 0 strcmp TC 0 0 "end" strcmp 0 for fscanf fscanf( fp, "", & 1, & 2,...); fscanf() scanf() fscanf() scanf() 57

58 ASCII ftoascii.c 1#include <stdio.h> /* printf, scanf, fopen,fprintf...*/ 2 3void main(void) 4{ 5 FILE *fp; /* */ 6 char filename[20]; /* */ 7 char ch=0; 8 9 printf("file name : "); 10 scanf("%19s", filename ); /* */ 11 fp = fopen( filename, "r"); 12 if( fp == NULL ) /* */ 13 printf("\acannot open %s!\n",filename); 14 else 15 for( ; ch!= EOF ; ) /* ch == EOF */ 16 { 17 fscanf( fp, "%c", &ch); /* */ 18 printf("%c = %d\n", ch, ch); 19 } 20 fclose(fp); 21} File name : ftoascii.c # = 35 i = 105 n = () } = 125 = ch!= EOF EOF (End Of File) fscanf 2space.c 1#include <stdio.h> /* printf, scanf, fopen,fprintf...*/ 2 3void main(void) 4{ 5 FILE *fpi, *fpo; /* */ 6 char filename[20]; /* */ 7 char ch=0; 8 9 printf("file to be read : "); 10 scanf("%19s", filename ); /* */ 11 fpi = fopen( filename, "r"); /* */ 12 if( fpi == NULL ) /* */ 13 { 14 printf("\acannot open %s!\n",filename); 58

59 15 return ; /* main() */ 16 } printf("file to be written : "); 19 scanf("%19s", filename ); /* */ 20 fpo = fopen( filename, "w"); /* */ 21 if( fpo == NULL ) /* */ 22 { 23 printf("\acannot open %s for output!\n",filename); 24 fclose(fpi); /* fpi */ 25 return ; /* main() */ 26 } for( ; ch!= EOF ; ) 29 { 30 fscanf( fpi, "%c", &ch); /* */ 31 fprintf( fpo, "%c", ch); /* */ 32 if( ch == '\n') /* */ 33 fprinf( fpo, "\n"); /* */ 34 } fclose(fpo); /* () */ 37 fclose(fpi); /* () */ 38} File to be read : test File to be written : doubled double Nanya_College $ ABC_Company $ IJK_lmn_... $ Xyz... $ zzzzzz $ ***** Total $

60 Help fopen: opens a stream FILE *fopen(const char *filename, fopen const char *mode); Prototype in stdio.h #include<stdio.h> Returns a pointer to the newly open stream if successful; else it returns NULL. NULL () See also fclose creat open dup ferror _fmode rewind setbuf setmode Help fclose: closes a stream int fclose(file *fp); fclose Prototype in stdio.h #include<stdio.h> Returns 0 on success; it returns EOF if any 0 errors are detected. EOF See also fflush flushall fopen close fcloseall Help fprintf: sends formatted output to a stream int fprintf(file *fp, const char *format,...);fprintf Prototype in stdio.h #include<stdio.h> Uses the same format specifiers as printf, printf() but fprintf sends output to the specified stream fp. fprintf returns the number of bytes fp output. In event of error, it returns EOF. See also putc fscanf Help fscanf: performs formatted input from a stream int fscanf(file *fp, const char *format,...); fscanf Prototype in stdio.h #include<stdio.h> Returns the number of input fields success- printf() fully scanned, converted, and stored; the fp return value does not include unstored scanned fields. See also getc fprintf scanf 60

61 Help strcmp: compares s2 to s1 int strcmp(const char *s1, const char *s2); strcmp Prototype in string.h #include<string.h> Returns a value that is < 0 if s1 is less than s1 < s2 < 0 s2; == 0 if s1 is the same as s2; > 0 if s1 is s1 = s2 = 0 greater than s2. Performs a signed comparison. s1 > s2 > 0 Help gets: gets a string from stdin stdin char *gets(char *string); gets Prototype in stdio.h #include<stdio.h> Collects input from stdin until a newline stdin character (\n) is found. The \n is not \n placed in the string. \n Returns a pointer to the argument string. See also ferror getc fopen puts fread scanf 61

C/C++ - 文件IO

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

More information

新版 明解C言語入門編

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

More information

CC213

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

More information

C C

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

More information

C/C++ - 函数

C/C++ - 函数 C/C++ Table of contents 1. 2. 3. & 4. 5. 1 2 3 # include # define SIZE 50 int main ( void ) { float list [ SIZE ]; readlist (list, SIZE ); sort (list, SIZE ); average (list, SIZE ); bargragh

More information

C

C C 2017 3 14 1. 2. 3. 4. 2/95 C 1. 3/95 C I 1 // talkback.c: 2 #include 3 #include 4 #define DENSITY 62.4 5 int main(void) 6 { 7 float weight, volume; 8 int size; 9 unsigned long letters;

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

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

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

More information

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

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

More information

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

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

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

More information

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

C/C++语言 - 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

( 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

C

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

More information

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

nooog

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

More information

C/C++ 语言 - 循环

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

FY.DOC

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

More information

untitled

untitled 8086/8088 CIP /. 2004.8 ISBN 7-03-014239-X.... TP313 CIP 2004 086019 16 100717 http://www.sciencep.com * 2004 8 2004 8 1 5 500 787 1092 1/16 16 1/2 391 000 1 2 ii 1 2 CAI CAI 3 To the teacher To the student

More information

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

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

More information

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

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

More information

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 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

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

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

More information

C 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

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 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

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

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

More information

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 不 料 料 例 : ( 料 ) 串 度 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

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

CC213

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

More information

Computer Architecture

Computer Architecture ECE 3120 Computer Systems Assembly Programming Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Prev: Basic computer concepts

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

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

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

新版 明解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

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

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc References (Section 5.2) Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 15-16, 2010 H.-T. Lin (NTU CSIE) References OOP 03/15-16/2010 0 / 22 Fun Time (1) What happens in memory? 1 i n t i ; 2

More information

科学计算的语言-FORTRAN95

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

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

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

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

More information

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

CHAPTER VC#

CHAPTER VC# 1. 2. 3. 4. CHAPTER 2-1 2-2 2-3 2-4 VC# 2-5 2-6 2-7 2-8 Visual C# 2008 2-1 Visual C# 0~100 (-32768~+32767) 2 4 VC# (Overflow) 2-1 2-2 2-1 2-1.1 2-1 1 10 10!(1 10) 2-3 Visual C# 2008 10! 32767 short( )

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

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

WWW PHP

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

More information

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

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

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

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

More information

Microsoft Word - 第3章.doc

Microsoft Word - 第3章.doc Java C++ Pascal C# C# if if if for while do while foreach while do while C# 3.1.1 ; 3-1 ischeck Test() While ischeck while static bool ischeck = true; public static void Test() while (ischeck) ; ischeck

More information

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

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

More information

untitled

untitled 串 串 例 : char ch= a ; char str[]= Hello ; 串 列 ch=getchar(); scanf( %c,&ch); 串 gets(str) scanf( %s,str); 8-1 數 ASCII 例 : char ch= A ; printf( %d,ch); // 65 A ascii =0x41 printf( %c,ch); // A 例 : char ch;

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

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

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

More information

untitled

untitled 1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-1-1 C int main(void){ int x,y,z; int sum=0; double avg=0.0; scanf("%d",&x) ; scanf("%d",&y) ; scanf("%d",&z) ; sum=x+y+z ; avg=sum/3.0; printf("%f\n",avg); system("pause");

More information

新・解きながら学ぶJava

新・解きながら学ぶJava 481! 41, 74!= 40, 270 " 4 % 23, 25 %% 121 %c 425 %d 121 %o 121 %x 121 & 199 && 48 ' 81, 425 ( ) 14, 17 ( ) 128 ( ) 183 * 23 */ 3, 390 ++ 79 ++ 80 += 93 + 22 + 23 + 279 + 14 + 124 + 7, 148, 16 -- 79 --

More information

02

02 Thinking in C++: Volume One: Introduction to Standard C++, Second Edition & Volume Two: Practical Programming C++ C C++ C++ 3 3 C C class C++ C++ C++ C++ string vector 2.1 interpreter compiler 2.1.1 BASIC

More information

,768 32,767 32K JMP Jnnn (386+) LOOP CALL [Label:] JMP short/near/far address L10: jmp jmp L20: L10 L20

,768 32,767 32K JMP Jnnn (386+) LOOP CALL [Label:] JMP short/near/far address L10: jmp jmp L20: L10 L20 (Jump) (Loop) (Conditional jump) CMP CALL AND SAR/SHR TEST JMP NOT SAL/SHL Jnnn* OR RCR/ROR LOOP XOR RCL/ROL RETn * nnn, JNE JL -128 127-32,768 32,767 32K JMP Jnnn (386+) LOOP CALL [Label:] JMP short/near/far

More information

C/C++ - 数组与指针

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

More information

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor 1 4.1.1.1 (Load) 14 1.1 1 4.1.1.2 (Save) 14 1.1.1 1 4.1.2 (Buffer) 16 1.1.2 1 4.1.3 (Device) 16 1.1.3 1 4.1.3.1 (Select Device) 16 2 4.1.3.2 (Device Info) 16 2.1 2 4.1.3.3 (Adapter) 17 2.1.1 CD-ROM 2 4.1.4

More information

Microsoft Word - template.doc

Microsoft Word - template.doc HGC efax Service User Guide I. Getting Started Page 1 II. Fax Forward Page 2 4 III. Web Viewing Page 5 7 IV. General Management Page 8 12 V. Help Desk Page 13 VI. Logout Page 13 Page 0 I. Getting Started

More information

Microsoft PowerPoint - 20-string-s.pptx

Microsoft PowerPoint - 20-string-s.pptx String 1 String/ 1.: char s1[10]; char *s2; char s3[] = "Chan Tai Man"; char s4[20] = "Chan Siu Ming"; char s5[]={'h','e','l','l','o','\0'; 0 1 2 3 4 5 6 7 8 9 10 11 12 s3 C h a n T a i \0 M a n \0 printf

More information

Microsoft PowerPoint - OPVB1基本VB.ppt

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

More information

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

coverage2.ppt

coverage2.ppt Satellite Tool Kit STK/Coverage STK 82 0715 010-68745117 1 Coverage Definition Figure of Merit 2 STK Basic Grid Assets Interval Description 3 Grid Global Latitude Bounds Longitude Lines Custom Regions

More information

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn Xi III Zebra XI III 1 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn 230V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666

More information

数据结构与算法 - Python基础

数据结构与算法 - Python基础 Python 教材及课件 课件及作业见网址 xpzhang.me 1 1. Python 2. 3. (list) (tuple) 4. (dict) (set) 5. 6. 7. 2 Python Python 3 Python 4 Python 1, 100, -8080, 0,... 0x 0-9, a-f 0 xff00, 0 xa432bf 5 1.24, 3.14, -9.80,...

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

The return of scanf The number of fields successfully converted and assigned int a =1, b =2, c =3; int n = scanf("%d %d %d", &a, &b, &c); printf("%d\n

The return of scanf The number of fields successfully converted and assigned int a =1, b =2, c =3; int n = scanf(%d %d %d, &a, &b, &c); printf(%d\n Introduction to Computer and Program Design Lesson 2 Functions, scanf and EOF James C.C. Cheng Department of Computer Science National Chiao Tung University The return of scanf The number of fields successfully

More information

四川省普通高等学校

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

More information

epub83-1

epub83-1 C++Builder 1 C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r C + + B u i l d e r 1.1 1.1.1 1-1 1. 1-1 1 2. 1-1 2 A c c e s s P a r a d o x Visual FoxPro 3. / C / S 2 C + + B u i l d e r / C

More information

Microsoft PowerPoint - STU_EC_Ch02.ppt

Microsoft PowerPoint - STU_EC_Ch02.ppt 樹德科技大學資訊工程系 Chapter 2: Number Systems Operations and Codes Shi-Huang Chen Sept. 2010 1 Chapter Outline 2.1 Decimal Numbers 2.2 Binary Numbers 2.3 Decimal-to-Binary Conversion 2.4 Binary Arithmetic 2.5

More information

Microsoft Word - chap13.doc

Microsoft Word - chap13.doc ï FILE dã Ä o rô qî ô Ö ƒù å o ô ÃÓ FILE Ã Ù Ö o v-> ª w ï FILE d wã +1 ~ c:\temp w Õx test.dat Ã Û vä à n ïw à test.dat 13-2a /* File name: ex13-2a.c */ #include char ch; fptr = fopen("c:\\temp\\test.dat",

More information

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco Windows RTEMS 1 Danilliu MMI TCP/IP 80486 QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos ecos Email www.rtems.com RTEMS ecos RTEMS RTEMS Windows

More information

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO Car DVD New GUI IR Flow User Manual V0.1 Jan 25, 2008 19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com Important Notice SUNPLUS

More information

IO

IO 1 C/C++ C FILE* fscanf fgets fread fprintf fputs fwrite C++ ifstream ofstream >>

More information

els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8

els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8 els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8 Yamaha ELS-0/0C..8 LCD ELS-0/0C v. typeu LCD ELS-0/0C typeu / -6 / [SEARCH] / - ZH ELS-0/0C.8 els0xu_zh_nf_v8.book Page Wednesday, June,

More information

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

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

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 MODBUS 1 MODBUS...1 1...4 1.1...4 1.2...4 1.3...4 1.4... 2...5 2.1...5 2.2...5 3...6 3.1 OPENSERIAL...6 3.2 CLOSESERIAL...8 3.3 RDMULTIBIT...8 3.4 RDMULTIWORD...9 3.5 WRTONEBIT...11 3.6 WRTONEWORD...12

More information

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

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

More information

42 2141601026 2016 11 27 2 1.1............................................. 2 1.2....................................... 2 1.2.1......................................... 2 1.3.............................................

More information

extend

extend (object oriented) Encapsulation Inheritance Polymorphism Dynamic Binding (base class) (derived class) 1 class Base { int I; void X(); void Y(); class Derived: public Base { private: int j; void z(); Derived

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

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC General instruction format for machine code 611 37100 微處理機原理與應用 Lecture 04-4 MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE

More information

PIC_SERVER (11) SMTP ( ) ( ) PIC_SERVER (10) SMTP PIC_SERVER (event driven) PIC_SERVER SMTP 1. E-

PIC_SERVER (11) SMTP  ( ) ( ) PIC_SERVER (10) SMTP  PIC_SERVER (event driven)  PIC_SERVER SMTP  1.  E- (2005-02-01) (2005-04-28) PIC_SERVER (10) SMTP E-mail PIC_SERVER (event driven) E-mail PIC_SERVER SMTP E-mail 1. E-mail E-mail 1 (1) (2) (3) (4) 1 1. 2 E-mail A E-mail B E-mail SMTP(Simple Mail Transfer

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

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

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

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

More information

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

Windows XP

Windows XP Windows XP What is Windows XP Windows is an Operating System An Operating System is the program that controls the hardware of your computer, and gives you an interface that allows you and other programs

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

Chapter 24 DC Battery Sizing

Chapter 24  DC Battery Sizing 26 (Battery Sizing & Discharge Analysis) - 1. 2. 3. ETAP PowerStation IEEE 485 26-1 ETAP PowerStation 4.7 IEEE 485 ETAP PowerStation 26-2 ETAP PowerStation 4.7 26.1 (Study Toolbar) / (Run Battery Sizing

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC 4.1 Converting Assembly Language Instructions to

More information

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

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

More information

untitled

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

More information

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

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

More information

EK-STM32F

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

More information

Bus Hound 5

Bus Hound 5 Bus Hound 5.0 ( 1.0) 21IC 2007 7 BusHound perisoft PC hound Bus Hound 6.0 5.0 5.0 Bus Hound, IDE SCSI USB 1394 DVD Windows9X,WindowsMe,NT4.0,2000,2003,XP XP IRP Html ZIP SCSI sense USB Bus Hound 1 Bus

More information