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

Size: px
Start display at page:

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

Transcription

1 C/C++ /

2 Table of contents

3

4 i # include <stdio.h> # include <string.h> // density of human body : e3 kg / m ^3 # define DENSITY e3 int main ( void ) { float weight, volume ; int size, letters ; char name [40]; printf ("Hi! What s your first name?\n"); scanf ("%s", name ); printf ("%s, what s your weight in kilograms?\n ", name ); 2

5 ii } scanf ("%f", & weight ); size = sizeof name ; letters = strlen ( name ); volume = weight / DENSITY ; printf ("Well, %s, your volume is %2.2 f cubic meters.\n", name, volume ); printf (" Also, your first name has % d letters,\ n", letters ); printf (" and we have % d bytes to store in it.\ n ", size ); return 0; 3

6 Hi! What s your first name? xiaoping xiaoping, what s your weight in kilograms? 60 Well, xiaoping, your volume is cubic meters. Also, your first name has 8 letters, and we have 40 bytes to store in it. 4

7 string " Once more you open the door!" 5

8 C C char # include <stdio.h> int main ( void ) { char greeting [6] = { H, e, l, l, o, \0 }; printf (" Greeting message : "); printf ("%s\n", greeting ); return 0; } 6

9 C++ C++ C C C C++ C++ string C++ string 7

10 // C style string # include <iostream > using namespace std ; int main () { char greeting [6] = " Hello "; cout << " Greeting message : "; cout << greeting << endl ; return 0; } // C++ string class # include <iostream > # include <string > using namespace std ; int main ( void ) { string greeting = " Hello "; cout << " Greeting message : "; cout << greeting << endl ; return 0; } 8

11 C C \0 \0 0 ASCII 0 \0 1 9

12 : array 10

13 : array char name [40]; 40 char 10

14 : array char name [40]; 40 char [] name [] 40 char 10

15 C \0 char greeting [10] = { H, e, l, l, 0, \0 }; 11

16 C \0 char greeting [10] = { H, e, l, l, 0, \0 }; char greeting [10] = " Hello "; 11

17 # include <stdio.h> # define PRAISE " What s a super marvelous name!" int main ( void ) { char name [40]; printf (" What s your name?\n"); scanf ("%s", name ); printf (" Hello, %s. %s\n", name, PRAISE ); return 0; } 12

18 # include <stdio.h> # define PRAISE " What s a super marvelous name!" int main ( void ) { char name [40]; printf (" What s your name?\n"); scanf ("%s", name ); printf (" Hello, %s. %s\n", name, PRAISE ); return 0; } What s your name? Xiaoping Zhang Hello, Xiaoping. What a super marvelous name! 12

19 # include < iostream > # include < string > using namespace std ; # define PRAISE " What s a super marvelous name!" int main ( void ) { string name ; cout << " What s your name?" << endl ; cin >> name ; cout << " Hello, " << name << ". " << PRAISE << endl ; return 0; } 13

20 # include < iostream > # include < string > using namespace std ; # define PRAISE " What s a super marvelous name!" int main ( void ) { string name ; cout << " What s your name?" << endl ; cin >> name ; cout << " Hello, " << name << ". " << PRAISE << endl ; return 0; } What s your name? Xiaoping Zhang Hello, Xiaoping. What a super marvelous name! 13

21 C \0 name scanf() name & name %s scanf() C++ cin 14

22 "x" x x "x" "x" x \0 15

23 C char name[40] = "Hello"; sizeof name name 40 strlen(name) name \0 5 C++ string name = "Hello"; sizeof name name.size() \0 5 16

24 # include <stdio.h> # include <string.h> # define PRAISE " What s a super marvelous name!" int main ( void ) { char name [40]; printf (" What s your name?\n"); scanf ("%s", name ); printf (" Hello, %s. %s\n", name, PRAISE ); printf (" Your name of % ld letters occupises % ld memory cells.\n", strlen ( name ), sizeof name ); printf (" PRAISE has % ld letters and occupies % ld memory cells.\n", strlen ( PRAISE ), sizeof PRAISE ); return 0; } 17

25 What s your name? Xiaoping Hello, Xiaoping. What a super marvelous name! Your name of 8 letters occupied 40 memory cells. PRAISE has 30 letters and occpied 31 memory cells. 18

26 i # include < iostream > # include < string > # include < cstring > using namespace std ; # define PRAISE " What s a super marvelous name!" int main ( void ) { string name ; cout << " What s your name?" << endl ; cin >> name ; cout << " Hello, " << name << ". " << PRAISE << endl ; cout << " Your name of " << name. size () 19

27 ii } << " letters occupies " << sizeof name << " memory cells." << endl ; cout << " PRAISE has " << strlen ( PRAISE ) << " letters and occupies " << sizeof PRAISE << " memory celss." << endl ; return 0; 20

28 What s your name? Xiaoping Hello, Xiaoping. What s a super marvelous name! Your name of 8 letters occupies 32 memory cells. PRAISE has 30 letters and occupies 31 memory celss. 21

29 string.h strlen C (1) printf scanfs stdio.h (2) strlen string.h 22

30 printf printf printf 23

31 sizeof strlen name = "Morgan" sizeof name : 40 strlen ( name ): 6 M o r g a n \0 24

32 sizeof strlen sizeof PRAISE : 29 strlen ( PRAISE ): 28 sizeof 25

33 sizeof sizeof ( float ) sizeof ( char ) sizeof name sizeof sizeof ( name ) sizeof (2.15) 26

34

35 // circle1.c: # include <stdio.h> int main ( void ) { float radius, circum, area ; radius = 1; area = * radius * radius ; circum = 2 * * radius ; printf (" radius = %f, circum = %f, area = %f\n", radius, circum, area ); return 0; } 27

36 // circle2.c: # include <stdio.h> int main ( void ) { float radius, circum, area ; float pi = ; radius = 1; area = pi * radius * radius ; circum = 2 * pi * radius ; printf (" radius = %f, circum = %f, area = %f\n", radius, circum, area ); return 0; } 28

37 // circle3.c: # include <stdio.h> # define PI int main ( void ) { float radius, circum, area ; radius = 1; area = PI * radius * radius ; circum = 2 * PI * radius ; printf (" radius = %f, circum = %f, area = %f\n", radius, circum, area ); return 0; } 29

38 // circle4.c: # include <stdio.h> int main ( void ) { float radius, circum, area ; const float PI = ; radius = 1.; area = PI * radius * radius ; circum = 2 * PI * radius ; printf (" radius = %f, circum = %f, area = %f\n", radius, circum, area ); return 0; } 30

39 # define NAME value 31

40 # define NAME value C 31

41 # define NAME value C #define " " # define BEEP \a # define TEE T # define ESC \033 # define OOPS " Now you have done it!" 31

42 # define B = 20 32

43 # define B = 20 B = c = a + B; c = a + = 20; 32

44 33

45 # include <stdio.h> # define MAX (a,b) ((a) > (b)? (a) : (b)) int main ( void ) { printf (" max (1, 2) = %d\n", MAX (1, 2)); printf (" max ( , 3.0) = %.2 f\n", MAX ( , 3.0) ); return 0; } 33

46 # include <stdio.h> # define MAX (a,b) ((a) > (b)? (a) : (b)) int main ( void ) { printf (" max (1, 2) = %d\n", MAX (1, 2)); printf (" max ( , 3.0) = %.2 f\n", MAX ( , 3.0) ); return 0; } max (1, 2) = max ( , 3.0) =

47 # include <stdio.h> # define MAX (a,b) (a) > (b)? (a) : (b) int main ( void ) { printf (" max (1, 2) = %d\n", MAX (1, 2)); printf (" max ( , 3.0) = %.2 f\n", MAX ( , 3.0) ); return 0; } 34

48 # include <stdio.h> # define MAX (a,b) (a) > (b)? (a) : (b) int main ( void ) { printf (" max (1, 2) = %d\n", MAX (1, 2)); printf (" max ( , 3.0) = %.2 f\n", MAX ( , 3.0) ); return 0; } max (1, 2) = max ( , 3.0) =

49 # include <stdio.h> # define PRINT_ SQUARE ( x) printf (" the square of " #x " is %d.\n", (x) * (x)); int main ( void ) { PRINT_ SQUARE (3) ; PRINT_SQUARE (3+2) ; return 0; } 35

50 # include <stdio.h> # define PRINT_ SQUARE ( x) printf (" the square of " #x " is %d.\n", (x) * (x)); int main ( void ) { PRINT_ SQUARE (3) ; PRINT_SQUARE (3+2) ; return 0; } the square of 3 is 9. the square of 3+2 is

51 # include <stdio.h> # define PRINT_ SQUARE ( x) printf (" the square of " #x " is %d.\n", x * x); int main ( void ) { PRINT_ SQUARE (3) ; PRINT_SQUARE (3+2) ; return 0; } 36

52 # include <stdio.h> # define PRINT_ SQUARE ( x) printf (" the square of " #x " is %d.\n", x * x); int main ( void ) { PRINT_ SQUARE (3) ; PRINT_SQUARE (3+2) ; return 0; } the square of 3 is 9. the square of 3+2 is

53 # include <stdio.h> # define PRINT (a) \ do { \ printf ("%s: %d\n", #a, a); \ printf ("%d: %d\n", a, a); \ } while (0) ; int main ( void ) { PRINT (3) ; PRINT (3+2) ; return 0; } 37

54 # include <stdio.h> # define PRINT (a) \ do { \ printf ("%s: %d\n", #a, a); \ printf ("%d: %d\n", a, a); \ } while (0) ; int main ( void ) { PRINT (3) ; PRINT (3+2) ; return 0; } 3: 3 3: 3 3+2: 5 5: 5 37

55 # include <stdio.h> # define X(n) x##n # define PXN (n) printf ("x"#n" = %d\n", x##n); int main ( void ) { int X (1) = 12; PXN (1) ; int X (2) = 24; PXN (2) ; int X (3) = 36; PXN (3) ; return 0; } 38

56 # include <stdio.h> # define X(n) x##n # define PXN (n) printf ("x"#n" = %d\n", x##n); int main ( void ) { int X (1) = 12; PXN (1) ; int X (2) = 24; PXN (2) ; int X (3) = 36; PXN (3) ; return 0; } x1 = 12 x2 = 24 x3 = 36 38

57 \ 39

58 \ # ## # x #x ## #define X(n) x##n X(2) x2. #define CONS(a,b) (a##e##b) CONS(2,3) 2e3. 39

59 const C90 const const int MONTHS = 12; MONTHS 40

60

61 1: %a p- %A P- %c %d %e e- %E E- %f %g %f %e %e -4 %G %f %E %E -4 41

62 2: %i %d %o %p %s %x 0-f %X 0-F 42

63 printf() printf(control-string, item1, item2,...); item1, item2,... (Control-string) 43

64 printf() printf(control-string, item1, item2,...); item1, item2,... (Control-string) printf( "You look great in %s\n", color ); 43

65 printf() printf(control-string, item1, item2,...); item1, item2,... (Control-string) printf( "You look great in %s\n", color ); 43

66 % %% printf (" Once more you open the door!\n"); printf ("%s%d\n", " area = ", area ); printf ("%d%% = %f\n", 30, 0.3) ; 44

67 %d // width.c: # include <stdio.h> # define N 1000 int main ( void ) { printf ("*%d*\n", N); printf (" *%2 d*\n", N); printf (" *%10 d*\n", N); printf (" *% -10 d*\n", N); printf (" *%010 d*\n", N); return 0; } 45

68 %d // width.c: # include <stdio.h> # define N 1000 int main ( void ) { printf ("*%d*\n", N); printf (" *%2 d*\n", N); printf (" *%10 d*\n", N); printf (" *% -10 d*\n", N); printf (" *%010 d*\n", N); return 0; } *1000* *1000* * 1000* *1000 * * * 45

69 %d %d 46

70 %d %d %md m m m 46

71 %d %d %md m m m %-md m m m 46

72 %d %0 md m m 0 m 47

73 // flags.c: # include <stdio.h> int main ( void ) { printf ("%x %X %#x %#X\n", 31, 31, 31, 31) ; printf ("*%d*\n", 42) ; printf ("*% d*\n", 42) ; printf ("*% d*\n", -42); printf (" *%5 d*\n", 6); printf (" *%5.3 d*\n", 6); printf (" *%05 d*\n", 6); printf (" *%05.3 d*\n", 6); return 0; } 48

74 %d 1f 1F 0 x1f 0 X1F *42* * 42* * -42* * 6* * 006* *00006* * 006* 49

75 %d % d 50

76 %d % d %m.nd, %0md, %0m.nd %5.3d %05d %05.3d

77 %x, %#x, %X, %#X %x, %#x, %X, %#X %x 1f %X 1F %#x 0x1f %#X 0X1F 51

78 %f, %e, %E // floats.c: # include <stdio.h> int main ( void ) { const double RENT = ; printf ("*%f*\n", RENT ); printf ("*%e*\n", RENT ); printf (" *%4.2 f*\n", RENT ); printf (" *%3.1 f*\n", RENT ); printf (" *%10.3 f*\n", RENT ); printf (" *%10.3 e*\n", RENT ); printf (" *%10.3 E*\n", RENT ); printf (" *%+4.2 f*\n", RENT ); printf (" *% f*\n", RENT ); printf (" *%010.2 f*\n", RENT ); printf (" *%10. f*\n", RENT ); printf (" *%.4 f*\n", RENT ); return 0; } 52

79 %f, %e, %E * * * e +03* * * *3853.0* * * * e +03* * E +03* * * * * * * 53

80 %f, %e, %E %m.nf %m.ne %m.ne m n 54

81 %f, %e, %E %m.nf %m.ne %m.ne m n %. nf n 54

82 %f, %e, %E %m.nf %m.ne %m.ne m n %. nf n %m.f m 54

83 %s // strings.c: # include <stdio.h> # define WORD " Hello World!" int main ( void ) { printf (" *%2 s*\n", WORD ); printf (" *%15 s*\n", WORD ); printf (" *%4.5 s*\n", WORD ); printf (" *% s*\n", WORD ); printf (" *%.5 s*\n", WORD ); return 0; } 55

84 %s // strings.c: # include <stdio.h> # define WORD " Hello World!" int main ( void ) { printf (" *%2 s*\n", WORD ); printf (" *%15 s*\n", WORD ); printf (" *%4.5 s*\n", WORD ); printf (" *% s*\n", WORD ); printf (" *%.5 s*\n", WORD ); return 0; } * Hello World!* * Hello World!* * Hello * * Hello * * Hello * 55

85 %f, %e, %E %s 56

86 %f, %e, %E %s %ms m m m 56

87 %f, %e, %E %s %ms m m m %m.ns m n m n m n n 56

88 %f, %e, %E %s %ms m m m %m.ns m n m n m n n %. ns n 56

89 printf() # include <stdio.h> int main ( void ) { int bph2o = 100; int rv; rv = printf (" Hello \n"); printf (" the printf function printed % d character.\n", rv); return 0; } 57

90 printf() # include <stdio.h> int main ( void ) { int bph2o = 100; int rv; rv = printf (" Hello \n"); printf (" the printf function printed % d character.\n", rv); return 0; } 100 C is water s boiling point. the printf function printed 32 character. printf() 57

91 printf() %n printf() %n %n 58

92 printf() %n printf() %n %n // printf_n.c: # include < stdio.h> int main ( void ) { int c1, c2; printf (" Hello Wuhan % nuniversity!%n\n", &c1, & c2); printf ("c1 = %d, c2 = %d\n", c1, c2); return 0; } 58

93 printf() %n printf() %n %n // printf_n.c: # include < stdio.h> int main ( void ) { int c1, c2; printf (" Hello Wuhan % nuniversity!%n\n", &c1, & c2); printf ("c1 = %d, c2 = %d\n", c1, c2); return 0; } Hello Wuhan University! c1 = 12, c2 = 23 58

94

95 printf() scanf() printf() scanf() 59

96 printf() scanf() printf() scanf() scanf() & scanf() & 59

97 scanf() // input.c: # include <stdio.h> int main ( void ) { int age ; double weight ; char name [20]; printf (" Enter your name, age and weight :\n"); scanf ("%s", name ); scanf ("%d, %lf", &age, & weight ); printf ("%s: %d %f\n", name, age, weight ); return 0; } 60

98 scanf() Enter your name, age and weight : Xiaoming Xiaoming :

99 scanf() scanf() %c printf() %f %e %E %g %G float double scanf() float double l 62

100 scanf %c %d %e, %f, %g, %a %E, %F, %G, %A %i %o %p 63

101 scanf %s %u %x, %X 64

102 scanf % 65

103 scanf % * %*d digit %10s hh signed char unsigned char % hhd %hhu ll long long unsigned long long %lld %llu 65

104 scanf() %hd, %hi %ho, %hx, %hu %ld, %li %lo, %lx, %lu %le, %lf, %lg %Le, %Lf, %Lg short unsigned short long unsigned long double long double 66

105 scanf() %hd, %hi %ho, %hx, %hu %ld, %li %lo, %lx, %lu %le, %lf, %lg %Le, %Lf, %Lg short unsigned short long unsigned long double long double %d, %i, %o %x int %e, %f, %g float 66

106 scanf() 67

107 scanf() scanf ("%d, %d", &n, &m); 67

108 scanf() scanf ("%d, %d", &n, &m); 12, 23 12, 23 12, 23 12, 23 67

109 scanf ("%d and %d", &n, &m); 68

110 scanf ("%d and %d", &n, &m); 12 and and and23 68

111 %c scanf ("%d%d",&n,&m); scanf ("%d %d",&n,&m); 69

112 %c scanf ("%c",&ch) scanf (" %c",&ch) 70

113 scanf() scanf() 0 (end of file) EOF EOF stdio.h -1 71

114 printf() * i // varwidth.c: # include <stdio.h> int main ( void ) { unsigned width, precision ; int number = 256; double weight = ; printf (" What field width?\n"); scanf ("%d", & width ); printf (" The number is :%* d\n", width, number ); printf (" Now enter a width and a precision :\ n") ; scanf ("%d %d", & width, & precision ); 72

115 printf() * ii } printf (" Weight =%*.* f\n", width, precision, weight ); return 0; 73

116 printf() * What field width? 6 The number is: 256 Now enter a width and a precision : 8 3 Weight =

117 scanf() * scanf() * % 75

118 scanf() * // skip2.c: # include <stdio.h> int main ( void ) { int n; printf (" Please enter three integers :\n"); scanf ("%*d %*d %d", &n); printf (" The last integer was %d\n", n); return 0; } 76

119 scanf() * // skip2.c: # include <stdio.h> int main ( void ) { int n; printf (" Please enter three integers :\n"); scanf ("%*d %*d %d", &n); printf (" The last integer was %d\n", n); return 0; } Please enter three integers : The last integer was 30 76

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

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

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

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++ - 文件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++ - 函数

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

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

More information

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

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

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

More information

C/C++ 语言 - 循环

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

More information

新版 明解C言語入門編

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

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言語 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言語入門編『索引』 !... 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_cpp

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

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

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

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

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

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

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 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

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

More information

新版 明解C++入門編

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

More information

C/C++ - 数组与指针

C/C++ - 数组与指针 C/C++ Table of contents 1. 2. 3. 4. 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

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

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

FY.DOC

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

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

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

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

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

C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 1 TEMPLATE 1 Template 描述 使用模板函数求最大值 使用如下 main 函数对程序进行测试 int main() { double a, b; cin >> a >> b; cout c >> d; cout

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

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++ 程序设计 告别 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 告别 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 告别 OJ1 - 参考答案 MASTER 2019 年 月 3 日 1 1 INPUTOUTPUT 1 InputOutput 题目描述 用 cin 输入你的姓名 ( 没有空格 ) 和年龄 ( 整数 ), 并用 cout 输出 输入输出符合以下范例 输入 master 999 输出 I am master, 999 years old. 注意 "," 后面有一个空格,"." 结束,

More information

C 1

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

More information

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

C/C++ - 结构体、共用体、枚举体 C/C++ Table of contents 1. 2. 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

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

第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

プログラムの設計と実現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

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

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

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

IO

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

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

新・解きながら学ぶ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

Strings

Strings Polymorphism and Virtual Functions Cheng-Chin Chiang Virtual Function Basics 多 型 (Polymorphism) 賦 予 一 個 函 數 多 種 意 涵, 存 在 於 同 一 類 別 之 內 祖 先 類 別 與 後 代 類 別 間 物 件 導 向 程 式 設 計 基 本 原 理 虛 擬 函 數 (Virtual Function)

More information

3.1 num = 3 ch = 'C' 2

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

More information

untitled

untitled 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

Microsoft PowerPoint - string_kruse [兼容模式]

Microsoft PowerPoint - string_kruse [兼容模式] Strings Strings in C not encapsulated Every C-string has type char *. Hence, a C-string references an address in memory, the first of a contiguous set of bytes that store the characters making up the string.

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

untitled

untitled (encapsulation) 例 類 說 類 料 來 料 information hiding 念 (inheritance) 來說 類 類 類 類 類 類 行 利 來 (polymorphism) 不 類 數 不 1 2 3 4 類 類 不 類 不 類 5 6 7 // virtual 不見了 #include #include using namespace

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

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

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

More information

untitled

untitled 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

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

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

More information

《C语言程序设计》教材习题参考答案

《C语言程序设计》教材习题参考答案 教 材 名 称 : C 语 言 程 序 设 计 ( 第 1 版 ) 黄 保 和 江 弋 编 著 清 华 大 学 出 版 社 ISBN: 978-7-302-13599-9, 红 色 封 面 答 案 制 作 时 间 :2011 年 2 月 -5 月 一 思 考 题 1 常 量 和 变 量 有 什 么 区 别? 它 们 分 别 是 如 何 定 义 的? 常 量 是 指 在 C 程 序 运 行 过 程 中

More information

責任政府與責任社會公共行政改革的方向與重點 學術研討會紀要

責任政府與責任社會公共行政改革的方向與重點 學術研討會紀要 責 任 政 府 與 責 任 社 會 公 共 行 政 改 革 的 方 向 與 重 點 學 術 研 討 會 紀 要 一 國 兩 制 研 究 編 輯 部 主 辦 : 澳 門 學 者 同 盟 澳 門 理 工 學 院 一 國 兩 制 研 究 中 心 時 間 :2009 年 8 月 27 日 下 午 3-6 時 地 點 : 澳 門 理 工 學 院 綜 合 樓 六 樓 1 號 會 議 室 主 持 人 : 駱 偉

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

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

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

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

More information

208 中 南 大 学 学 报 ( 社 会 科 学 版 ) 2013 年 第 19 卷 第 6 期 节 目 录 上 卷 一 所 载 篇 名, 乃 总 目 录 中 篇 名 之 误, 正 文 卷 一 收 录 篇 名 为 月 支 使 者 玄 觉 杜 凝 妻 灌 国 婴 女 独 狐 及 吕 卿 均 五 篇

208 中 南 大 学 学 报 ( 社 会 科 学 版 ) 2013 年 第 19 卷 第 6 期 节 目 录 上 卷 一 所 载 篇 名, 乃 总 目 录 中 篇 名 之 误, 正 文 卷 一 收 录 篇 名 为 月 支 使 者 玄 觉 杜 凝 妻 灌 国 婴 女 独 狐 及 吕 卿 均 五 篇 第 19 卷 第 6 期 中 南 大 学 学 报 ( 社 会 科 学 版 ) Vol.19 No.6 2013 年 12 月 J. CENT. SOUTH UNIV. (SOCIAL SCIENCE) Dec. 2013 篇 目 考 辨 三 则 以 韩 藏 详 节 为 校 勘 依 据 盛 莉 ( 江 汉 大 学 人 文 学 院, 湖 北 武 汉,430056) 摘 要 : 详 节 为 朝 鲜 时 期

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

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

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

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

More information

Gerotor Motors Series Dimensions A,B C T L L G1/2 M G1/ A 4 C H4 E

Gerotor Motors Series Dimensions A,B C T L L G1/2 M G1/ A 4 C H4 E Gerotor Motors Series Size CC-A Flange Options-B Shaft Options-C Ports Features 0 0 5 5 1 0 1 0 3 3 0 0 SAE A 2 Bolt - (2) 4 Bolt Magneto (4) 4 Bolt Square (H4) 1.0" Keyed (C) 25mm Keyed (A) 1.0' 6T Spline

More information

Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number 5.2007 Volume 2.Number

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

ebook39-5

ebook39-5 5 3 last-in-first-out, LIFO 3-1 L i n e a r L i s t 3-8 C h a i n 3 3. 8. 3 C + + 5.1 [ ] s t a c k t o p b o t t o m 5-1a 5-1a E D 5-1b 5-1b E E 5-1a 5-1b 5-1c E t o p D t o p D C C B B B t o p A b o

More information

<4D F736F F D20B2C43032B3B920B8EAAEC6ABACBA41BB50AAEDA5DCA6A12E646F63>

<4D F736F F D20B2C43032B3B920B8EAAEC6ABACBA41BB50AAEDA5DCA6A12E646F63> C++ î Á 2-1! C Ã Ñ Ó 2-1.1! î ô à i¾ ò{î ~ à } Ñ lf ŠÈx«v ~ C ÃÑ lî nùƒ f d Û Ã ó ÎÛol ƒ à ó dîû Ê óãi Š~ v C v ÃÈxi á «constant Û Ù Ã ˆ ó nù d «12-452 100000 0 d 'A' 'Z' 8.23 0.1232 0.001 ŒÛ~ iñ C++ ó

More information

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

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

More information

概述

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

More information

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

Microsoft Word - 97.01.30軟體設計第二部份範例試題_C++_ _1_.doc

Microsoft Word - 97.01.30軟體設計第二部份範例試題_C++_ _1_.doc 電 腦 軟 體 設 計 乙 級 技 術 士 技 能 檢 定 術 科 測 試 範 例 試 題 (C++) 試 題 編 號 :11900-920201-4 審 定 日 期 : 94 年 7 月 1 日 修 訂 日 期 : 96 年 2 月 1 日 97 年 1 月 30 日 ( 第 二 部 份 ) 電 腦 軟 體 設 計 乙 級 技 術 士 技 能 檢 定 術 科 測 試 應 檢 參 考 資 料 壹 試

More information

第7章-并行计算.ppt

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

More information

2015年下半年全国教师资格笔试《地理学科知识与教学能力》备考指导

2015年下半年全国教师资格笔试《地理学科知识与教学能力》备考指导 2016 年 上 半 年 全 国 教 师 资 格 统 考 英 语 学 科 知 识 与 教 学 能 力 高 分 攻 略 中 公 教 育 教 师 考 试 研 究 院 制 初 级 中 学 一 考 情 综 述 通 过 分 析 真 题, 可 以 发 现 在 英 语 学 科 知 识 和 教 学 能 力 ( 初 中 英 语 ) 笔 试 中, 英 语 教 学 知 识 和 教 学... 设 计 能 力... 所 占

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

科学计算的语言-FORTRAN95

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

More information

Strings

Strings Inheritance Cheng-Chin Chiang Relationships among Classes A 類 別 使 用 B 類 別 學 生 使 用 手 機 傳 遞 訊 息 公 司 使 用 金 庫 儲 存 重 要 文 件 人 類 使 用 交 通 工 具 旅 行 A 類 別 中 有 B 類 別 汽 車 有 輪 子 三 角 形 有 三 個 頂 點 電 腦 內 有 中 央 處 理 單 元 A

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

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

C++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 1 PERSON 1 Person 题目描述 编写程序, 定义一个基类 Person, 包含 name 和 age 两个数据成员 ; 再由它派生出学生类 Student 和教师类 Teacher, 其中学生类添加学号 no 数据, 教师类添加职称 title 数据 ; 要求每个类均有构造函数 析构函数和显示数据的函数

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

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

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

More information

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

甄選入學howhow作印刷校過版

甄選入學howhow作印刷校過版 甄 選 入 學 How How 作 中 山 工 商 輔 導 處 編 著 ( 泰 宇 出 版 社 出 版 ) 1 過 去 國 內 的 教 育 幾 乎 是 以 聯 考 來 主 導 教 師 的 教 學 方 向, 此 種 一 元 化 的 入 學 方 式 讓 學 校 教 育 偏 重 智 育 的 發 展, 學 生 為 了 成 績 只 能 反 覆 的 過 度 的 練 習, 不 僅 降 低 學 生 的 學 習 興

More information

Microsoft PowerPoint - L17_Inheritance_v4.pptx

Microsoft PowerPoint - L17_Inheritance_v4.pptx C++ Programming Lecture 17 Wei Liu ( 刘 威 ) Dept. of Electronics and Information Eng. Huazhong University of Science and Technology May. 2015 Lecture 17 Chapter 20. Object-Oriented Programming: Inheritance

More information

Microsoft Word - 01.DOC

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

More information

<4D6963726F736F667420576F7264202D20AE61AC462DBFAFADB9AD70B565BB50BB73A740B1D0AED7>

<4D6963726F736F667420576F7264202D20AE61AC462DBFAFADB9AD70B565BB50BB73A740B1D0AED7> 膳 食 計 畫 與 製 作 教 案 設 計 一 教 學 設 計 依 據 () 根 據 99 新 課 綱 十 大 主 題 之 膳 食 計 畫 與 製 作 主 題 設 定 教 學 內 容 (2) 考 量 目 前 高 中 課 程 開 課 現 況, 將 教 學 時 間 設 定 為 每 學 期 兩 學 分, 並 依 此 時 間 安 排 進 行 教 學 設 計 (3) 創 意 的 發 想 : 以 賓 果 遊 戲

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

FZUBRIDGE

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

More information

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

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc 2 5 8 11 0 1. 13 2. 15 3. 18 1 1. 22 2. 25 3. 27 2 1. 35 2. 38 3. 41 4. 43 5. 48 6. 50 3 1. 56 2. 59 3. 63 4. 65 5. 69 13 22 35 56 6. 74 7. 82 8. 84 9. 87 10. 97 11. 102 12. 107 13. 111 4 114 1. 114 2.

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

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

Eclipse C C++, or

Eclipse C C++,  or Eclipse C C++, Emailctchen@pl.csie.ntut.edu.tw or s1669021@ntut.edu.tw, s2598003@ntut.edu.tw http://pl.csie.ntut.edu.tw/~ctchen, http://www.ntut.edu.tw/~s2598003/ 2004/9/10 (0.02 ) Eclipse http://www.eclipse.org

More information

1505.indd

1505.indd 上 海 市 孙 中 山 宋 庆 龄 文 物 管 理 委 员 会 上 海 宋 庆 龄 研 究 会 主 办 2015.05 总 第 148 期 图 片 新 闻 2015 年 9 月 22 日, 由 上 海 孙 中 山 故 居 纪 念 馆 台 湾 辅 仁 大 学 和 台 湾 图 书 馆 联 合 举 办 的 世 纪 姻 缘 纪 念 孙 中 山 先 生 逝 世 九 十 周 年 及 其 革 命 历 程 特 展

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