为提高我们的程序品质特将林博士的资料作为我公司程序员的学习教材,请各位读读,我把我的看法用红字表出,供大家探讨

Size: px
Start display at page:

Download "为提高我们的程序品质特将林博士的资料作为我公司程序员的学习教材,请各位读读,我把我的看法用红字表出,供大家探讨"

Transcription

1 C++/C [ ] [] [ ] / V V V

2 Windows Unix if for switch goto const #define

3 free delete malloc/free new/delete malloc/free new/delete C

4 9.4 String String const A C++/C 114 B C++/C 119 C C++/C 125 C++/C N-1

5 Internet (1) (2) (3) (4) (5) (6) (7) (8) (9) 30 (10) 9:00 5:00 9: C++/C CAD 3D

6 C++ 3D 3D strcpy IT

7 IT if 14 C++/C IT 1

8 B C++/C C++/C 4 C++/C

9 Bug CMMI CMMI C++/C CMMI

10 C++/C implemen definition C++/C.h C.c C++.cpp.cc / 4 /* * Copyright (c) 2001, * All rights reserved. * * filename.h * *

11 * * 1.1 * * * * 1.0 * * */ graphics.h ifndef/define/endif #include <filename.h> #include filename.h

12 1-2-1 C extern int value #include myheader.h // 1-1 #ifndef GRAPHICS_H // graphics.h #define GRAPHICS_H #include <math.h> // #include myheader.h // void Function1(); // class Box // ; #endif 1-2 C++/C

13 graphics.cpp 1-3 // 1-1 #include graphics.h // // void Function1() // void Box::Draw()

14 1-3 C++/C 1.4 BasicFortran C++/C include source INCLUDE API SRC DOC TEST INCLUDE SRC SRC

15 a b // void Function1() // void Function2() // while (condition) statement1; // if (condition) statement2;

16 // void Function3() else statement3; // statement4; 2-1(a) 2-1(b) ifforwhiledo 2-2a 2-2b int width; int height; int depth; x = a + b; y = c + d; // // // int width, height, depth; // X a + b; y = c + d; z = e + f;

17 z = e + f; if (width < height) if (width < height) dosomething(); dosomething(); for (initialization; condition; update) for (initialization; condition; update) dosomething(); dosomething(); other(); // other(); 2-2(a) 2-2(b) int width = 10; // width int height = 10; // height int depth = 10; // depth constvirtualinlinecase ifforwhile

18 ; Function(x, y, z); for (initialization; condition; update) =+= >= <=+ *%&& <<, ^ 2-3-6!~ > for if for (i=0; i<10; i++)if ((a<=b) && (c<=d)) void Func1(int x, int y, int z); // void func( int x, int y, int z ); // void Func1 (int x,int y,int z); if (year >= 2000) // // if(year>=2000) // if ((a>=b) && (c<=d)) // if(a>=b&&c<=d) for (i=0; i<10; i++) // // for( I=0; I<10; I++ ) // for(i=0;i<10;i++) // for (i = 0; i < 10; i ++) x = a < b? a : b; // // x=a<b?a:b; int *x = &y; // // int * x = & y; //

19 array[5] = 0; // array [ 5 ] = 0; a.function(); b->function(); // a. Function(); // b -> Function(); a 2-4b void Function(int x) // program code if (condition) // program code else void Function(int x) // program code // if (condition) // program code else // program code //

20 // program code for (initialization; condition; update) for (initialization; condition; update) // program code // program code While (condition) while (condition) // program code // program code 2-4(a) 2-4(b)

21 2-5-2 if ((very_longer_variable1 >= very_longer_variable12) && (very_longer_variable3 <= very_longer_variable14) && (very_longer_variable5 <= very_longer_variable16)) dosomething(); virtual CMatrix CMultiplyMatrix (CMatrix leftmatrix, CMatrix rightmatrix); for (very_longer_initialization; very_longer_condition; very_longer_update) dosomething(); * * int* x; x int int* y x, y; x y

22 2-6-1 * char *name; int *x, y; // y 2.7 C /* */ C++/* // i++; // i

23 2-7-8 /* * * * * */ if () while () void Function(float x, float y, float z) // end of while // end of if publicprotectedprivate 1 private public 8-3 a

24 2 public private 8.3 b C++ Biarne Stroustrup class A private: int i, j; float x, y; public: void Func1(void); void Func2(void); class A public: void Func1(void); void Func2(void); private: int i, j; float x, y; 8.3(a) 8.3(b)

25 3 Microsoft ch p ppch int i, j, k; float x, y, z; int ii, ij, ik; // i int float fx, fy, fz; // f float CurrentValue NowValue

26 3-1-2 min-length && max-information ANSI C 6 C++/C! maxval maxvalueuntiloverflow i,j,k,m,n,x,y,z Windows AddChild Unix add_child int x, X; // x X void foo(int x); // foo FOO void FOO(float x); float value; float oldvalue; float newvalue;

27 3-1-7 DrawBox(); // box->draw(); // int int minvalue; maxvalue; int int SetValue(); GetValue(); Value1,Value2 3.2 Windows Windows class Node; //

28 class LeafNode; void Draw(void); // // void SetValue(int value); // BOOL flag; int drawmode; const int MAX = 100; const int MAX_LENGTH = 100; s_ static void Init() static int s_initvalue; // g_ global

29 int g_howmanypeople; // int g_howmuchmoney; // m_ member void Object::SetValue(int width, int height) m_width = width; m_height = height; OpenGL gl GL 3.3 Unix 4 ifforwhilegotoswitch C++/C 4.1

30 C++/C * ( ) [ ] ->.! ~ sizeof + - * & * / % + - << >> < <= > >= ==!= & ^ &&?: = += -= *= /= %= &= ^= = <<= >>= word = (high << 8) low if ((a b) && (a & c))

31 4.2 a = b = c = i = a >= b && c < d && c + f <= g + h ; // d = (a = b + c) + r ; a d a = b + c; d = a + r; if (a < b < c) // a < b < c if ((a<b) && (b<c)) if ( (a<b)<c ) 4.3 if

32 if C++/C if TRUEFALSE 10 FALSE TRUE TRUE Visual C++ TRUE 1Visual Basic TRUE -1 flag if if (flag) // flag if (!flag) // flag if (flag == TRUE) if (flag == 1 ) if (flag == FALSE) if (flag == 0) === 0 value if if (value == 0) if (value!= 0) if (value) // value if (!value)

33 === float double === x if (x == 0.0) // if ((x>=-epsinon) && (x<=epsinon)) EPSINON === NULL NULL 0 p if if (p == NULL) // p NULL p if (p!= NULL) if (p == 0) // p if (p!= 0) if (p) // p if (!p) if

34 if (NULL == p) if (p == NULL) if (p = pnull) NULL if (p = NULL) if (NULL NULL = p) if/else/return if (condition) return x; return y; if (condition) return x; else return y; return (condition? x : y); 4.4 C++/C for while do CPU 4-4(b) 4-4(a)

35 for (row=0; row<100; row++) for (col=0; col<5; col++ ) for ( col=0; col<5; col++ ) for (row=0; row<100; row++) sum = sum + a[row][col]; sum = sum + a[row][col]; 4-4(a) 4-4(b) (c) 4-4(d) N-1 N 4-4(d) N 4-4(c) for (i=0; i<n; i++) if (condition) if (condition) for (i=0; i<n; i++) DoSomething(); DoSomething(); else DoOtherthing(); else for (i=0; i<n; i++)

36 DoOtherthing(); 4-4(c) 4-4(d) 4.5 for for for for 4-5(a) x 0 =< x < N N 4-5(b) x 0 =< x <= N-1 N 4-5(a) for (int x=0; x<n; x++) for (int x=0; x<=n-1; x++) 4-5(a) 4-5(b) 4.6 switch if switch switch if if switch switch switch (variable)

37 case value1 : break; case value2 : break; default : break; case break default default default : break; default 4.7 goto goto goto goto goto state; String s1, s2; // goto int sum = 0; // goto state:

38 goto C++/C goto goto goto break ; goto error; error: goto goto,, GOTO 5 C #define C++ #define const const 5.1

39 #define MAX 100 /* C */ const int MAX = 100; // C++ const const float PI = ; // C++ const 5.2 const #define C++ const #define 1 const 2 const C++ const const

40 const float RADIUS = 100; const float DIAMETER = RADIUS * 2; 5.4 #define const const const const const SIZE class A const int SIZE = 100; // const int array[size]; // SIZE ; const class A A(int size); // const int SIZE ; ; A::A(int size) : SIZE(size) //

41 A A a(100); // a SIZE 100 b(200); // b SIZE 200 const class A ; enum SIZE1 = 100, SIZE2 = 200; // int array1[size1]; int array2[size2]; PI= C++/C C pass by valuepass C++ by pointer pass by reference 6.6

42 void void SetValue(int width, int height); // void SetValue(int, int); // float GetValue(void); // float GetValue(); // StringCopy str1 str2 void StringCopy(char *str1, char *str2); str1 str2 strsource strdestination strsource strdestination void StringCopy(char *strsource, char *strdestination); char str[20]; StringCopy(str, Hello World); //

43 6-1-3 const void StringCopy(char *strdestinationconst char *strsource); C printf int printf(const chat *format[, argument]); C void C++ C C++/ C void C getchar char c;

44 c = getchar(); if (c == EOF) getchar c char getchar char int int getchar(void); c char [ ] EOF char if getchar return C getchar int getchar getchar EOF 1 getchar int return getchar BOOL GetChar(char *c); gechar GetChar putchar(getchar()); getchar strcpy char *strcpy(char *strdestconst char *strsrc); strcpy strsrc strdest strdest

45 char str[20]; int length = strlen( strcpy(str, Hello World) ); class String // String & operate=(const String &other); // friend friend String operate+( const String &s1, const String &s2); private: char *m_data; String operate = String & String::operate=(const String &other) if (this == &other) return *this; delete m_data; m_data = new char[strlen(other.data)+1]; strcpy(m_data, other.data);

46 return *this; // *this String return *this String a,b,c; a = b; // *this a = b = c; // *this String operate + String operate+(const String &s1, const String &s2) String temp; delete temp.data; // temp.data 0 temp.data = new char[strlen(s1.data) + strlen(s2.data) +1]; strcpy(temp.data, s1.data); strcat(temp.data, s2.data); return temp; String temp temp

47 c = a + b; a + b c return return return return 1return char * Func(void) char str[] = hello world; // str return str; // 2 3 return

48 return String(s1 + s2); temp String temp(s1 + s2); return temp; temp temp temp return int(x + y); // int temp = x + y; return temp; int,float,double C/C++ static static

49 6.5 Debug Release Debug Release assert Debug 6-5 assert assert void *memcpy(void *pvto, const void *pvfrom, size_t size) assert((pvto!= NULL) && (pvfrom!= NULL)); // byte *pbto = (byte *) pvto; // pvto byte *pbfrom = (byte *) pvfrom; // pvfrom while(size -- > 0 ) *pbto ++ = *pbfrom ++ ; return pvto; 6-5 assert Debug Release assert assert assert assert assert assert

50 [Maguire, p8-p30] C++ m referencem referent int m; int &n = m; n m n m n m m n m 1 2 NULL NULL 3 k i k = j k j k 6 k i i 6 int i = 5; int j = 6;

51 int &k = i; k = j; // k i 6; C++ Func1 x n x n, n 0 void Func1(int x) x = x + 10; int n = 0; Func1(n); cout << n = << n << endl; // n = 0 Func2 x n n n 10 void Func2(int *x) (* x) = (* x) + 10; int n = 0; Func2(&n);

52 cout << n = << n << endl; // n = 10 Func3 x n x n x n n 10 void Func3(int &x) x = x + 10; int n = 0; Func3(n); cout << n = << n << endl; // n = 10 7 Bill Gates 640K ought to be enough for everybody

53 Bill Gates static 2 3 malloc new free delete 7.2 NULL p assert(p!=null) malloc new if(p==null) if(p!=null)

54 1 1 for malloc free new/delete 1 2 return 3 free delete NULL malloc new NULL NULL

55 free delete NULL 7.3 C++/C a 6 hello 0a a[0]= X p world world 0 p[0]= X char a[] = hello; a[0] = X; cout << a << endl; char *p = world; // p p[0] = X; // cout << p << endl; 7-3-1

56 a b b = a strcpy b a if(b==a) strcmp p = a a p a p a malloc p strlen(a)+1 strcpy if(p==a) strcmp // char a[] = "hello"; char b[10]; strcpy(b, a); // b = a; if(strcmp(b, a) == 0) // if (b == a) // int len = strlen(a); char *p = (char *)malloc(sizeof(char)*(len+1)); strcpy(p,a); // p = a; if(strcmp(p, a) == 0) // if (p == a)

57 sizeof 7-3-3a sizeof(a) 12 0 p a sizeof(p) 4 sizeof(p) sizeof(char*) p C++/C b a sizeof(a) sizeof(char *) char a[] = "hello world"; char *p = a; cout<< sizeof(a) << endl; // 12 cout<< sizeof(p) << endl; // a void Func(char a[100]) cout<< sizeof(a) << endl; // b Test GetMemory(str, 200) str str NULL void GetMemory(char *p, int num)

58 p = (char *)malloc(sizeof(char) * num); void Test(void) char *str = NULL; GetMemory(str, 100); // str NULL strcpy(str, "hello"); // GetMemory p _p _p = p p _p _p p GetMemory GetMemory free void GetMemory2(char **p, int num) *p = (char *)malloc(sizeof(char) * num); void Test2(void) char *str = NULL; GetMemory2(&str, 100); // &str

59 strcpy(str, "hello"); cout<< str << endl; free(str); char *GetMemory3(int num) char *p = (char *)malloc(sizeof(char) * num); return p; void Test3(void) char *str = NULL; str = GetMemory3(100); strcpy(str, "hello"); cout<< str << endl; free(str); 7-4-3

60 return return char *GetString(void) char p[] = "hello world"; return p; // void Test4(void) char *str = NULL; str = GetString(); // str cout<< str << endl; return Test4 str = GetString str NULL str hello world char *GetString2(void) char *p = "hello world"; return p;

61 void Test5(void) char *str = NULL; str = GetString2(); cout<< str << endl; return Test5 GetString2 GetString2 hello world GetString2 7.5 free delete free delete delete 7-5 p free NULL p p NULL p p p if (p!= NULL) if p NULL char *p = (char *) malloc(100); strcpy(p, hello); free(p); // p p

62 if(p!= NULL) // strcpy(p, world); // 7-5 p p void Func(void) char *p = (char *) malloc(100); // NULL NULL

63 7.7 NULL NULL if 1 NULL NULL char *p = NULL; char *str = (char *) malloc(100); 2 p free delete NULL p class A public: void Func(void) cout << Func of class A << endl; ; void Test(void) A *p; A a; p = &a; // a

64 p->func(); // p Test p->func() a p a p 7.8 malloc/free new/delete malloc free C++/C new/delete C++ maloc/free malloc/free malloc/free C++ new delete new/delete malloc/free new/delete 7-8 class Obj public : Obj(void) cout << Initialization << endl; ~Obj(void) cout << Destroy << endl; void Initialize(void) cout << Initialization << endl; void Destroy(void) cout << Destroy << endl; ;

65 void UseMallocFree(void) Obj *a = (obj *)malloc(sizeof(obj)); // a->initialize(); // // a->destroy(); // free(a); // void UseNewDelete(void) Obj *a = new Obj; // // delete a; // 7-8 malloc/free new/delete Obj Initialize Destroy UseMallocFree malloc/free Initialize Destroy UseNewDelete malloc/free new/delete malloc/free new/delete new/delete malloc/free C++ malloc/free C++ C C malloc/free

66 free new delete malloc new/delete malloc/free 7.9 malloc new NULL 1 NULL return void Func(void) A *a = new A; if(a == NULL) return; 2 NULL exit(1) void Func(void) A *a = new A; if(a == NULL) cout << Memory Exhausted << endl;

67 exit(1); 3 new malloc Visual C++ _set_new_hander new malloc new C exit(1) exit(1) 32 malloc new Windows 98 Visual C Window Unix Windows void main(void)

68 float *p = NULL; while(true) p = new float[ ]; cout << eat memory << endl; if(p==null) exit(1); malloc/free malloc void * malloc(size_t size); malloc length int *p = (int *) malloc(sizeof(int) * length); u malloc void * malloc void * u malloc int, float int float cout << sizeof(char) << endl; cout << sizeof(int) << endl; cout << sizeof(unsigned int) << endl;

69 cout << sizeof(long) << endl; cout << sizeof(unsigned long) << endl; cout << sizeof(float) << endl; cout << sizeof(double) << endl; cout << sizeof(void *) << endl; malloc () sizeof p = malloc(sizeof(p)) u free void free( void * memblock ); free malloc p free(p) p NULL free p p NULL free p UNIX malloc /* coremap swapmap COREMAP 64BYTE SWAPMAP 512BYTE 4KBYTE */ struct map char *m_size; char *m_addr;

70 malloc( struct map *mp, int size ) register int a; register struct map *bp; for( bp = mp; bp->m_size; bp++ ) if( bp->m_size >= size ) a = bp->m_addr; bp->m_addr += size; if(( bp->m_size =- size ) == 0 ) do bp++; (bp 1)->m_addr = bp->m_addr while(( bp-1)->m_size = bp->m_size ); return(a); return( 0 ); 7.11 new/delete new malloc int *p1 = (int *)malloc(sizeof(int) * length); int *p2 = new int[length];

71 new sizeof new new class Obj public : Obj(void); Obj(int x); // // void Test(void) Obj *a = new Obj; Obj *b = new Obj(1); // 1 delete a; delete b; new Obj *objects = new Obj[100]; // 100 Obj *objects = new Obj[100](1);// delete [] delete []objects; // delete objects; //

72 delete objects[0] C++/C C 1 C C++ C C++overloadedinline const virtual virtual C C++ C EatBeef,EatFish,EatChicken Eat

73 void EatBeef(); // void Eat(Beef ); void EatFish(); // void Eat(Fish ); void EatChicken(); // void Eat(Chicken ); Eat C void Function(void); int Function (void); int int x = Function (); Function C++/C Function Eat _eat_beef_eat_fish_eat_chicken

74 C++ C C void foo(int x, int y); C _foo C++_foo_int_int C C++ C externc extern C void foo(int x, int y); // extern C #include myheader.h // C C++ foo C _foo _foo_int_intc++ C externc include void Print(); //

75 class A void Print(); // Print Print :: ::Print(); // Print output int output float output(0.5) int float # include <iostream.h> void output( int x); // void output( float x); // void output( int x) cout << " output int " << x << endl ; void output( float x)

76 cout << " output float " << x << endl ; void main(void) int x = 1; float y = 1.0; output(x); // output int 1 output(y); // output float 1 output(1); // output int 1 // output(0.5); // error! ambiguous call, output(int(0.5)); // output int 0 output(float(0.5)); // output float override C

77 virtual virtual Base::f(int)Base::f(float) Base::g(void) Derived::g(void) #include <iostream.h> class Base public: void f(int x) cout << "Base::f(int) " << x << endl; void f(float x) cout << "Base::f(float) " << x << endl; virtual void g(void) cout << "Base::g(void)" << endl; ; public: class Derived : public Base

78 virtual void g(void) cout << "Derived::g(void)" << endl; ; void main(void) Derived d; Base *pb = &d; pb->f(42); // Base::f(int) 42 pb->f(3.14f); // Base::f(float) 3.14 pb->g(); // Derived::g(void) C++ 1 virtual 2 virtual 8-2-2a 1 Derived::f(float) Base::f(float) 2 Derived::g(int) Base::g(float) 3 Derived::h(float) Base::h(float)

79 #include <iostream.h> class Base public: virtual void f(float x) cout << "Base::f(float) " << x << endl; void g(float x) cout << "Base::g(float) " << x << endl; void h(float x) cout << "Base::h(float) " << x << endl; ; class Derived : public Base public: virtual void f(float x) cout << "Derived::f(float) " << x << endl; void g(int x) cout << "Derived::g(int) " << x << endl; void h(float x) cout << "Derived::h(float) " << x << endl; ; 8-2-2a C bbp dp void main(void)

80 Derived d; Base *pb = &d; Derived *pd = &d; // Good : behavior depends solely on type of the object pb->f(3.14f); // Derived::f(float) 3.14 pd->f(3.14f); // Derived::f(float) 3.14 // Bad : behavior depends on type of the pointer pb->g(3.14f); // Base::g(float) 3.14 pd->g(3.14f); // Derived::g(int) 3 (surprise!) // Bad : behavior depends on type of the pointer pb->h(3.14f); // Base::h(float) 3.14 (surprise!) pd->h(3.14f); // Derived::h(float) b pd->f(10) Base::f(int) Base::f(int) Derived::f(char *) 10 class Base public:

81 void f(int x); ; class Derived : public Base public: void f(char *str); ; void Test(void) Derived *pd = new Derived; pd->f(10); // error pd->f(10) Derived::f(char *) Derived f pd->f(10) f pd->f(10) Base::f(int) Derived class Derived : public Base public:

82 void f(char *str); void f(int x) Base::f(x); ; void Foo(int x=0, int y=0); // void Foo(int x=0, int y=0) // void Foo(int x, int y=0, int z=0); void Foo(int x=0, int y, int z=0);

83 8-3-2 output #include <iostream.h> void output( int x); void output( int x, float y=0.0); void output( int x) cout << " output int " << x << endl ; void output( int x, float y) cout << " output int " << x << " and float " << y << endl ; void main(void) int x=1; float y=0.5; // output(x); // error! ambiguous call output(x,y); // output int 1 and float 0.5

84 C++ operator Complex Add(const Complex &a, const Complex &b); Complex operator +(const Complex &a, const Complex &b); Complex a, b, c; c = Add(a, b); // c = a + b; // + p44-p47] = () [] ->

85 += -= /= *= &= = ~= %= >>= <<= C C++ 1 C++ int,float C++#,@,$ C++ C CALL return #define MAX(a, b) (a) > (b)? (a) : (b)

86 result = MAX(i, j) + 2 ; result = (i) > (j)? (i) : (j) + 2 ; +: result = ( (i) > (j)? (i) : (j) ) + 2 ; #define MAX(a, b) ( (a) > (b)? (a) : (b) ) result = MAX(i++, j); result = (i++) > (j)? (i++) : (j); C++ C++ C++ C++ assert assert Debug Debug Release assert assert Debug Release assert

87 inline inline Foo inline void Foo(int x, int y); // inline void Foo(int x, int y) Foo void Foo(int x, int y); inline void Foo(int x, int y) // inline inline inline inline C++/C class A public: void Foo(int x, int y) //

88 // class A public: void Foo(int x, int y) // inline void A::Foo(int x, int y) inline

89 8.6 C++ C++ 9 A C++ A A(void); A(const A &a); ~A(void); A & operate =(const A &a); // // // // 1 C++ Stroustrup 2 C++

90 String class String public: String(const char *str = NULL); // String(const String &other); // ~ String(void); // String & operate =(const String &other); // private: char *m_data; // ; 9.1 C C++ Stroustrup C++ Stroustrup ~ void

91 9.2 class A A(int x); // A ; class B : public A B(int x, int y);// B ; B::B(int x, int y) : A(x) // A const 5.4 u

92 class A A(void); // A(const A &other); // A & operate =( const A &other); // class B public: B(const A &a); // B private: A m_a; // ; 9-2(a) B A m_a 9-2 (b) B m_a B m_a A A a m_a B::B(const A &a) B::B(const A &a) : m_a(a)

93 m_a = a; 9-2(a) 9-2(b) F class F public: F(int x, int y); // private: int m_x, m_y; int m_i, m_j; 9-2(c)F 9-2(d)F F::F(int x, int y) F::F(int x, int y) : m_x(x), m_y(y) m_x = x; m_i = 0; m_y = y; m_j = 0; m_i = 0; m_j = 0;

94 9-2(c) 9-2(d) 9.3 [Eckel, p String // String String::String(const char *str) if(str==null) m_data = new char[1]; *m_data = 0; else int length = strlen(str); m_data = new char[length+1]; strcpy(m_data, str);

95 // String String::~String(void) delete [] m_data; // m_data delete m_data; 9.5 u String a,b a.m_data hello b.m_data world a b b.m_data = a.m_data b.m_data b.m_data a.m_data a b m_data u String a(hello); String b(world); String c = a; // c(a); c = b; //

96 String c(a) 9.6 String // String::String(const String &other) // other m_data int length = strlen(other.m_data); m_data = new char[length+1]; strcpy(m_data, other.m_data); // String & String::operate =(const String &other) // (1) if(this == &other) return *this; // (2) delete [] m_data; // 3 int length = strlen(other.m_data);

97 m_data = new char[length+1]; strcpy(m_data, other.m_data); // 4 return *this; String 9.4 NULL NULL String 1 // // b = a; b = &a; c = b; a = *b; a = c; delete if if(this == &other)

98 if( *this == other) 2 delete 3 strlen 0 strcpy 0 4 return *this return this return other other other return other 9.7 class A private: A(const A &a); // A & operate =(const A &a); // ; A b(a); // b = a; //

99 A 9.8 virtual #include <iostream.h> class Base ; public: virtual ~Base() cout<< "~Base" << endl ; class Derived : public Base public: virtual ~Derived() cout<< "~Derived" << endl ; ; void main(void) Base * pb = new Derived; // upcast delete pb;

100 ~Derived ~Base ~Base class Base public: Base & operate =(const Base &other); // Base private: int m_i, m_j, m_k; ; class Derived : public Base public: Derived & operate =(const Derived &other); // Derived private: int m_x, m_y, m_z;

101 ; Derived & Derived::operate =(const Derived &other) //1 if(this == &other) return *this; //2 Base::operate =(other); // //3 m_x = other.m_x; m_y = other.m_y; m_z = other.m_z; //4 return *this; 9.9 C++

102 Big-Three[Cline] [Meyers] [M 10 ObjectClassInstance C++ InheritanceComposition COM CORBA C++ COM CORBA 10.1 A B A B A public: class A void void Func1(void); Func2(void); ; class B : public A

103 public: void Func3(void); void Func4(void); ; main() B b; b.func1(); // B A Func1 b.func2(); // B A Func2 b.func3(); b.func4(); C A B B B A B A a kind of B A ManHuman Man Human Boy Man class Human

104 ; class Man : public Human ; class Boy : public Man ; OstrichBird Bird Ostrich::Fly class Bird public: virtual void Fly(void); ; class Ostrich : public Bird

105 ; CircleEllipse Ellipse B A A B B A A B a part of B A A B EyeNoseMouthEar Head EyeNoseMouthEar class Eye class Nose public: public: void Look(void); void Smell(void); ; class Mouth ; class Ear public: public: void Eat(void); void Listen(void); ; ; // class Head

106 public: void Look(void) m_eye.look(); void Smell(void) m_nose.smell(); void Eat(void) m_mouth.eat(); void Listen(void) m_ear.listen(); private: Eye Nose Mouth Ear m_eye; m_nose; m_mouth; m_ear; ; Head EyeNoseMouthEar Head Eye Nose Mouth Ear Head LookSmell EatListen // class Head : public Eye, public Nose, public Mouth, public Ear ; Head EyeNoseMouthEar

107 const const C++ const const const constant const C++ const whenever you need const const const const StringCopy void StringCopy(char *strdestination, const char *strsource); strsource strdestination strsource const strsource

108 const void Func1(int x) void Func1(const int x) void Func2(A a) void Func2(const A a) A void Func(A a) A a void Func(A &a) void Func(A &a) a const void Func(const A &a) void Func(int x) void Func(const int &x) const & const void Func(A a) void Func(const A &a) void Func(int x) void Func(const int &x) const & const const const

109 const char * GetString(void); char *str = GetString(); const char *str = GetString(); const int GetInt(void) const int GetInt(void) A GetA(void) const A GetA(void) A A GetA(void) const A & GetA(void) 6.2 class A A & operate = (const A &other); // ; A a, b, c; // a, b, c A a = b = c; // (a = b) = c; //

110 const a = b = c (a = b) = c const const const const stack GetCount GetCount const GetCount class Stack public: void int Push(int elem); Pop(void); int GetCount(void) const; // const private: int int m_num; m_data[100]; ; int Stack::GetCount(void) const ++ m_num; // m_num Pop(); // const return m_num;

111 const const

112 &&<= >= I/O

113 PC-LintLogiScope [Cline] Marshall P. Cline and Greg A. Lomow, C++ FAQs, Addison-Wesley, 1995 [Eckel] Bruce Eckel, Thinking in C++C [Maguire] Steve Maguire, Writing Clean Code 1993 [Meyers] Scott Meyers, Effective C++, Addison-Wesley, 1992 [Murry] Robert B. Murry, C++ Strategies and Tactics, Addison-Wesley, 1993 [Summit] Steve Summit, C Programming FAQs, Addison-Wesley, 1996

114 A C++/C ifndef/define/endif? Ifforwhiledo * public, protected, private min-length && max-information

115 if? 1 TRUEFALSE 10 2== = 3=== NULL Case break switch default goto? C++ const const const

116 return assert assert return const const Use const whenever you need malloc new NULL 1 2 free delete NULL malloc/free new/delete malloc new/delete

117 C++ C *this virtual 4

118 1 B A A B B A 2 A B a part of B A A B

119 I/O B C++/C C++/C C++/C C++/C 90 BOOL, float, if 0, 0.0, FALSE n int if if ( n == 0 ) if ( n!= 0 )

120 BOOL flag if float x if char *p if Windows NT 32 C++ sizeof 10 char str[] = Hello ; char *p = str ; int n = 10; sizeof (str ) = void Func ( char str[100]) sizeof( str ) = sizeof ( p ) = sizeof ( n ) = void *p = malloc( 100 ); sizeof ( p ) =

121 25 1 ifndef/define/endif 2#include <filename.h> #include filename.h 3const 4 C++ C extern 5 for // for (i=0; i<n; i++) // if (condition)

122 if (condition) DoSomething(); else DoOtherthing(); for (i=0; i<n; i++) DoSomething(); else for (i=0; i<n; i++) DoOtherthing(); 20 void GetMemory(char *p) p = (char *)malloc(100); char *GetMemory(void) char p[] = "hello world"; return p;

123 void Test(void) char *str = NULL; GetMemory(str); strcpy(str, "hello world"); printf(str); void Test(void) char *str = NULL; str = GetMemory(); printf(str); Test Test Void GetMemory2(char **p, int num) *p = (char *)malloc(num); void Test(void) char *str = NULL; GetMemory(&str, 100); strcpy(str, "hello"); void Test(void) char *str = (char *) malloc(100); strcpy(str, hello); free(str); if(str!= NULL) strcpy(str, world); printf(str);

124 printf(str); Test Test strcpy 10 strcpy char *strcpy(char *strdest, const char *strsrc); strdest strsrc 1 C++/C strcpy

125 2strcpy strsrc strdest char * 25 String String class String public: String(const char *str = NULL); String(const String &other); // // ~ String(void); // String & operate =(const String &other); // private: char *m_data; // ; String 4 C C++/C BOOL, float, if

126 BOOL flag if 3 if ( flag ) if (flag == TRUE) if (!flag ) if (flag == 1 ) if (flag == FALSE) if (flag == 0) float x if 4 const float EPSINON = ; if ((x >= - EPSINON) && (x <= EPSINON) if (x == 0.0) === if (x!= 0.0) >=<= char *p if 3 if (p == NULL) if (p == 0) if (p!= NULL) if (p!= 0) if (p) if (!) Windows NT 32 C++ sizeof 10

127 char str[] = Hello ; char *p = str ; int n = 10; void Func ( char str[100]) sizeof( str ) = 4 2 sizeof (str ) = 6 2 sizeof ( p ) = 4 2 sizeof ( n ) = 4 2 void *p = malloc( 100 ); sizeof ( p ) = ifndef/define/endif 5 2#include <filename.h> #include filename.h 5 #include <filename.h> fil #include filename.h 3const 5 1 const 2const const

128 4 C++ C extern C 5 C++C C++ C void foo(int x, in C _foo C++ _foo_int_int C++ C externc 5 for 5 for (i=0; i<n; i++) if (condition) if (condition) for (i=0; i<n; i++) DoSomething(); DoSomething(); else DoOtherthing(); else for (i=0; i<n; i++) DoOtherthing(); N-1

129 5 20 void GetMemory(char *p) p = (char *)malloc(100); void Test(void) char *str = NULL; GetMemory(str); strcpy(str, "hello world"); printf(str); char *GetMemory(void) char p[] = "hello world"; return p; void Test(void) char *str = NULL; str = GetMemory(); printf(str); Test Test GetMemory GetMemory NULL Test str NULL strcpy(str, "hello world"); void GetMemory2(char **p, int num) void Test(void)

130 *p = (char *)malloc(num); void Test(void) char *str = NULL; GetMemory(&str, 100); strcpy(str, "hello"); printf(str); char *str = (char *) malloc(100); strcpy(str, hello); free(str); if(str!= NULL) strcpy(str, world); printf(str); Test Test 1 hello 2 free(str);str if(str!= NULL) strcpy 10 strcpy char *strcpy(char *strdest, const char *strsrc); strdest strsrc 1 C++/C strcpy char *strcpy(char *strdest, const char *strsrc);

131 assert((strdest!=null) && (strsrc!=null)); // 2 char *address = strdest; // 2 while( (*strdest++ = * strsrc++)!= 0 ) // 2 NULL ; return address ; // 2 2strcpy strsrc strdest char * // 2 int length = strlen( strcpy( strdest, hello world) ); 25 String String class String public: String(const char *str = NULL); String(const String &other); // // ~ String(void); // String & operate =(const String &other); // ; private: char *m_data; //

132 String 4 // String String::~String(void) // 3 delete [] m_data; // m_data delete m_data; // String String::String(const char *str) // 6 if(str==null) m_data = new char[1]; // NULL *m_data = 0 ; else int length = strlen(str); m_data = new char[length+1]; // NULL strcpy(m_data, str);

133 // String::String(const String &other) // 3 int length = strlen(other.m_data); m_data = new char[length+1]; // NULL strcpy(m_data, other.m_data); // String & String::operate =(const String &other) // 13 // (1) // 4 if(this == &other) return *this; // (2) // 3 delete [] m_data; // 3 // 3 int length = strlen(other.m_data); m_data = new char[length+1]; // NULL strcpy(m_data, other.m_data); // 4 // 3

134 return *this;

/ V 0.9 V 1.0 2001-7-1 2001-7-18 2001-7-18 2001-7-24 V 0.9 2001 Page 2 of 101

/ V 0.9 V 1.0 2001-7-1 2001-7-18 2001-7-18 2001-7-24 V 0.9 2001 Page 2 of 101 C++/C [ ] 1.0 [ ] [ ] 2001 7 24 / V 0.9 V 1.0 2001-7-1 2001-7-18 2001-7-18 2001-7-24 V 0.9 2001 Page 2 of 101 ...6 1...8 1.1...8 1.2...8 1.3...8 1.4...8 1.5...8 2...8 2.1...8 2.2...8 2.3...8 2.4...8 2.5...8

More information

<4D6963726F736F667420576F7264202D20B8DFD6CAC1BF432B2BB1E0B3CCD6B8C4CF2E646F63>

<4D6963726F736F667420576F7264202D20B8DFD6CAC1BF432B2BB1E0B3CCD6B8C4CF2E646F63> 高 质 量 C++/C 编 程 指 南 文 件 状 态 [ ] 草 稿 文 件 文 件 标 识 : 当 前 版 本 : 1.0 [ ] 正 式 文 件 作 者 : 林 锐 博 士 [ ] 更 改 正 式 文 件 完 成 日 期 : 2001 年 7 月 24 日 版 本 历 史 版 本 / 状 态 作 者 参 与 者 起 止 日 期 备 注 V 0.9 林 锐 2001-7-1 至 林 锐 起 草

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

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++入門編

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

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

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

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

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

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

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

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

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++ 面 试 试 题 汇 总 柯 贤 富 管 理 软 件 需 求 分 析 篇 1. STL 类 模 板 标 准 库 中 容 器 和 算 法 这 部 分 一 般 称 为 标 准 模 板 库 2. 为 什 么 定 义 虚 的 析 构 函 数? 避 免 内 存 问 题, 当 你 可 能 通 过 基 类 指 针 删 除 派 生 类 对 象 时 必 须 保 证 基 类 析 构 函 数 为 虚 函 数 3.

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

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

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

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

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

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

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

More information

C/C++ - 文件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 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

Microsoft Word - 01.DOC

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

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

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

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

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

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

More information

Chapter12 Derived Classes

Chapter12   Derived Classes 继 承 -- 派 生 类 复 习 1. 有 下 面 类 的 说 明, 有 错 误 的 语 句 是 : class X { A) const int a; B) X(); C) X(int val) {a=2 D) ~X(); 答 案 :C 不 正 确, 应 改 成 X(int val) : a(2) { 2. 下 列 静 态 数 据 成 员 的 特 性 中, 错 误 的 是 A) 说 明 静 态 数

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

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

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

概述

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

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

四川省普通高等学校

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

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

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

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

Microsoft Word - 970617cppFinalSolution.doc

Microsoft Word - 970617cppFinalSolution.doc 國 立 台 灣 海 洋 大 學 資 訊 工 程 系 C++ 程 式 設 計 期 末 考 參 考 答 案 姓 名 : 系 級 : 學 號 : 97/06/17 考 試 時 間 :10:00 12:10 試 題 敘 述 蠻 多 的, 看 清 楚 題 目 問 什 麼, 針 對 重 點 回 答 是 很 重 要 的 ; 不 確 定 的 請 一 定 要 當 場 提 出 來, 不 要 白 花 力 氣 在 誤 會

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

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

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

More information

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

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

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

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

More information

untitled

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

More information

Microsoft Word - 11.doc

Microsoft Word - 11.doc 除 錯 技 巧 您 將 於 本 章 學 到 以 下 各 項 : 如 何 在 Visual C++ 2010 的 除 錯 工 具 控 制 下 執 行 程 式? 如 何 逐 步 地 執 行 程 式 的 敘 述? 如 何 監 看 或 改 變 程 式 中 的 變 數 值? 如 何 監 看 程 式 中 計 算 式 的 值? 何 謂 Call Stack? 何 謂 診 斷 器 (assertion)? 如 何

More information

Microsoft Word - ch04三校.doc

Microsoft Word - ch04三校.doc 4-1 4-1-1 (Object) (State) (Behavior) ( ) ( ) ( method) ( properties) ( functions) 4-2 4-1-2 (Message) ( ) ( ) ( ) A B A ( ) ( ) ( YourCar) ( changegear) ( lowergear) 4-1-3 (Class) (Blueprint) 4-3 changegear

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

IO

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

More information

ebook8-30

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

More information

C

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

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

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

More information

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

Microsoft Word - PHP7Ch01.docx

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

More information

CHAPTER 1

CHAPTER 1 CHAPTER 1 1-1 System Development Life Cycle; SDLC SDLC Waterfall Model Shelly 1995 1. Preliminary Investigation 2. System Analysis 3. System Design 4. System Development 5. System Implementation and Evaluation

More information

ebook50-15

ebook50-15 15 82 C / C + + Developer Studio M F C C C + + 83 C / C + + M F C D L L D L L 84 M F C MFC DLL M F C 85 MFC DLL 15.1 82 C/C++ C C + + D L L M F C M F C 84 Developer Studio S t u d i o 292 C _ c p l u s

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

<4D F736F F D D342DA57CA7DEA447B14D2DA475B57BBB50BADEB27AC3FEB14DA447B8D5C344>

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

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

Microsoft Word - 物件導向編程精要.doc

Microsoft Word - 物件導向編程精要.doc Essential Object-Oriented Programming Josh Ko 2007.03.11 object-oriented programming C++ Java OO class object OOP Ruby duck typing complexity abstraction paradigm objects objects model object-oriented

More information

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

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

More information

第3章.doc

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

More information

Chapter 9: Objects and Classes

Chapter 9: Objects and Classes Fortran Algol Pascal Modula-2 BCPL C Simula SmallTalk C++ Ada Java C# C Fortran 5.1 message A B 5.2 1 class Vehicle subclass Car object mycar public class Vehicle extends Object{ public int WheelNum

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

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

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

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

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

第5章修改稿

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

More information

Strings

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

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

Strings

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

More information

第七讲 继承与多态

第七讲  继承与多态 第 七 章 继 承 与 派 生 1 本 章 主 要 内 容 的 继 承 成 员 的 访 问 控 制 单 继 承 与 多 继 承 派 生 的 构 造 析 构 函 数 成 员 的 标 识 与 访 问 深 度 探 索 2 的 继 承 与 派 生 的 继 承 与 派 生 保 持 已 有 的 特 性 而 构 造 新 的 过 程 称 为 继 承 在 已 有 的 基 础 上 新 增 自 己 的 特 性 而 产 生

More information

序 软 件 工 程 思 想 林 锐 序 软 件 工 程 思 想 讲 述 软 件 开 发 和 做 程 序 员 的 道 理, 视 野 独 特, 构 思 新 颖, 内 容 风 趣, 不 落 窠 臼, 令 人 耳 目 一 新 堪 称 难 得, 以 至 回 味 无 穷 作 者 从 事 了 八 年 的 软 件 开 发 工 作, 在 他 的 博 士 学 位 论 文 完 成 之 际 写 下 了 这 本 心 之 所 感

More information

untitled

untitled CHAPTER 02 2 CHAPTER 2-1 2-4 2-2 2-5 2-3 2-6 2-1 2-1-1 2-2 02 int A[3] = {10, 20, 30; A[0] 10 A[1] 20 A[2] 30 int *pa[3], A[3]; C 3 pa pa[0]pa[1]pa[2] 3 A A[0]A[1]A[2] 3 A A[0] A + i A[i] A + i &A[i]*(A

More information

1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET NET Framework.NET Framework 2.0 ( 3 ).NET Framework 2.0.NET F

1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET NET Framework.NET Framework 2.0 ( 3 ).NET Framework 2.0.NET F 1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET 2.0 2.0.NET Framework.NET Framework 2.0 ( 3).NET Framework 2.0.NET Framework ( System ) o o o o o o Boxing UnBoxing() o

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

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

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

More information

版本历史 版本 / 状态 作者 参与者 起止日期 备注 V 0.9 林锐 至 林锐起草 草稿文件 V 1.0 正式文件 林锐 至 朱洪海审查 V 0.9, 林锐修正草稿中的错误 2001 Page 2 of 101

版本历史 版本 / 状态 作者 参与者 起止日期 备注 V 0.9 林锐 至 林锐起草 草稿文件 V 1.0 正式文件 林锐 至 朱洪海审查 V 0.9, 林锐修正草稿中的错误 2001 Page 2 of 101 高质量 C++/C 编程指南 文件状态文件标识 : [ ] 草稿文件当前版本 : 1.0 [ ] 正式文件作者 : 林锐博士 [ ] 更改正式文件完成日期 : 2001 年 7 月 24 日 版本历史 版本 / 状态 作者 参与者 起止日期 备注 V 0.9 林锐 2001-7-1 至 林锐起草 草稿文件 2001-7-18 V 1.0 正式文件 林锐 2001-7-18 至 2001-7-24 朱洪海审查

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

第一章 章标题-F2 上空24,下空24

第一章 章标题-F2 上空24,下空24 2 C# C# C#.NET ASP.NET C# C# C# 2.1 C# C#.NET.NET C#.NET C# CLR C#.NET 2.1.1 C# C# C++ Visual Basic C# C++ C++ C# C#.NET C# C C++ C#. C# C# C# C# 2.1.2 C# C# 2-01.cs C# 2-01.cs class Hello{ public static

More information

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

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

More information

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

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

More information

华恒家庭网关方案

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

More information

1

1 1 2 3 4 5 GNUDebugger 6 7 void main(int argc, char **argv){ vulncpy(argv[1]); return; } void vulncpy(char *a){ char buf[30]; strcpy(buf, a); return; } *argv[1] buf Shellcode *argv[1]... &buf &buf 8 strcpy

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

Scott Effective C++ C++ C++ Roger Orr OR/2 ISO C++ Effective Modern C++ C++ C++ Scoot 42 Bart Vandewoestyne C++ C++ Scott Effective Modern C++ Damien

Scott Effective C++ C++ C++ Roger Orr OR/2 ISO C++ Effective Modern C++ C++ C++ Scoot 42 Bart Vandewoestyne C++ C++ Scott Effective Modern C++ Damien Effective Modern C++ C++ C++ C++11/C++14 C++ Scott Meyers Gerhard Kreuzer Siemens AG Effective Modern C++ Effective Modern C++ Andrei Alexandrescu Facebook Modern C++ Design C++ C++ Nevin Liber DRW Trading

More information

用户大会 论文集2.2.doc

用户大会 论文集2.2.doc MagGis MapGis GIS MagGis API DLL MapGis VC++ VB BC++ Delphi., Windows API MapGis VC++V Delphi Delphi Delphi MapGis Delphi Delphi Windows Delphi Delphi MapGis MapGis DLL API MapGis function _InitWorkArea(HINST:Integer):Integer;

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++ 程序设计员应聘常见面试试题深入剖析 silver6 25 九月, 2006 09:07 本文的写作目的并不在于提供 C/C++ 程序员求职面试指导, 而旨在从技术上分析面试题的内涵 文中的大多数面试题来自各大论坛, 部分试题解答也参考了网友的意见 许多面试题看似简单, 却需要深厚的基本功才能给出完美的解答 企业要求面试者写一个最简单的 strcpy 函数都可看出面试者在技术上究竟达到了怎样的程度,

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 - 把时间当作朋友(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