2

Size: px
Start display at page:

Download "2"

Transcription

1 C

2 2

3 Contents sizeof union reference static const volatile mutable explicit typedef new & delete class i

4 ii CONTENTS 2.3 static bit-field virtual virtual inheritance RTTI run-time type identification dynamic cast typeid type info template empty size() Standard Template Library (STL) functional function objects Operator classes Adaptor and conversion functions Instrumental types count() count if() vector<bool>?

5 CONTENTS iii iterator const iterator reverse iterator const reverse iterator distance advance const iterator iterator reverse iterator base() iterator remove erase remove

6 iv CONTENTS

7 Chapter ɛ 1.2 #include <ctype.h> : isupper(c), tolower(c) *prt a; *prt b++; // ++(*ptr a); // *(prt b++); = 2. = +1 1

8 2 CHAPTER char char a = 256 ; int d = a ; cout<<d<<endl ; // long double 1. long double long double 2. long double double double 3. double float float 4. 3 int integral promotion char signed char unsigned char short int int unsigned short short 2 int 4 unsigned short int unsigned int wchar t underlying type enum status bad, ok } ; 0 1. char char char status int (a) unsigned long unsigned long

9 (b) unsigned long long long long long unsigned int long unsigned int 32 long int 4 1 unsigned int long unsigned long long unsigned int unsigned int int C++ 4 dynamic cast(expression) dynamic cast safe downcasting static cast(expression) static cast non-const const int double void* const non-const const cast C-style const cast(expression) const cast C++ reinterpret cast(expression) reinterpret cast inplementationdependent 1. grep 2. const cast

10 4 CHAPTER C++ automatic static dynamic sizeof sizeof 4. char str[] = 123 ; // 4 \0 2 4 struct Struct char ch1 ; // 2 short sn ; //2 char ch2 ; // 2 6 sn int 4 12 ch1 ch2 4 sn double 8 16 ch1 ch2 4 struct struct Struct Struct array[2] ; cout<<sizeof array<<endl ; // class B: public virtual A... 4 virtual 4 class A public: A() ; A() ; virtual void f() } 4

11 1.7. SIZEOF 5 sizeof sizeof sizeof(a1) 4 class A1 public: int a ; static int b ; A1() ; A1() ; sizeof strlen 1. sizeof strlen 2. sizeof size t typedef unsigned int 3. sizeof strlen char* \0 sizeof short f() ; cout<<sizeof(f())<<endl ; sizeof(short) 2 4. sizeof strlen 5. sizeof sizeof(x) 6. strlen 7. sizeof sizeof 8. sizeof char s[100] sizeof sizeof 9. sizeof void

12 6 CHAPTER union struct / union test test() } int office; char teacher[5];. a test a.class a.office int main() union int test; char c; test=5; c= a ; std::cout<<i<< <<c ; return 0 ; } (static)

13 = const char * : const char : int (*p)(int, int); : int (*p1)(int,...); int (*p2)(int); int (*(*F)(int,int))(int); F int int int int float(**def)[10]; def float double*(*gh)[10]; gh double* double(*f[10])(); f f 10 double int*((*b)[10]); int* (*b)[10]; int fun(int);, p2=fun;, p2=&fun;

14 8 CHAPTER 1. p2 p2(3); (*p2)(3); reference lvalue x a[i] *ptr int & ra=a, & rb=b; 1.11 alias namespace abc = somelongname; namespace const int SIZE = 64 ; int max ; } 1.12 extern extern int a;

15 1.13. STATIC static static new static static / static static public protected private :: = private public ( ). :: name-mangling static static const const

16 10 CHAPTER 1. nonmember. -> :: 1.14 const const char greeting[]= Hello. // const mutable const const mutable C++ #define const const #define const const const C const bufsize ; C++ C C const C++ const C++ C extern extern const bufsize ; // const const extern

17 1.15. VOLATILE volatile volatile volatile volatile const volatile volatile 1.16 mutable const mutable mutable const 1.17 explicit C++ class MyClass public: MyClass( int num ) ; // constructor and implicit conversion operator... MyClass obj = 10 ; //ok,convert int to MyClass MyClass MyClass temp 10 ; MyClass obj = temp ; explicit MyClass class MyClass public: explicit MyClass( int num ) ;... MyClass obj1 = 10 ; // error,can t non-explict convert MyClass obj2 ; obj2 = 20 ; // error,can t non-explict convert

18 12 CHAPTER 1. explicit 1.18 typedef typedef char * StringArray[]; main(int argc, StringArray argv) // StringArray argv == char * argv[] : typedef char SString[256]; // SString 256 typedef enum TagLink, Thread // Tag enumlink, Thread} 1.19 new & delete int *m=new int[20]; int *j=new(11); // 20 int // 11 new new (ptr) type ptr <new> delete [] arrayname; malloc/free malloc/free malloc/free C++ new delete new/delete 1.20 TP TP TP & const TP

19 signatures TP & const TP & const TP * TP * TP * TP []

20 14 CHAPTER 1.

21 Chapter 2 class 2.1 array-style struct const member-initializer : static 1. static.cpp 2. static this static ClassName:: 3. static 2.4 bit-field bit-field 15

22 16 CHAPTER 2. CLASS class File //... unsigned int modified : 1 ; // modified bit-field 5 unsigned int mode typedef unsigned int Bit ; class File public: Bit mode: 2 ; Bit modified: 1 ; Bit prot owner: 3 ; Bit prot group: 3 ; Bit prot world: 3 ; inline enum READ = 01, WRITE = 02 } ; inline int File::isRead() return mode & READ ; } inline int File::isWrite() return mode & WRITE ; } & C++ bitset 2.5 virtual virtual virtual

23 static : virtual void swap index(int i, int j) const= 0; class test public: virtual int a(int &i)=0;... test exam; //Error new delete operand 2.

24 18 CHAPTER 2. CLASS 3. ** 4. = [] () -> 2.7 outward conversion operator type(); : operator double(); static cast<double>(obj) double(obj) obj.operator double() 2.8 operator= 3 1. public

25 2.9. VIRTUAL INHERITANCE private 3. protected protected private private protected 2.9 virtual inheritance C++ vitual base class : class Derived : public virtual Base... // public virtual

26 20 CHAPTER 2. CLASS RTTI run-time type identification RTTI C++ RTTI

27 2.10. RTTI RUN-TIME TYPE IDENTIFICATION dynamic cast 2. typeid dynamic cast dynamic cast downcasting C++ dynamic cast dynamic cast dynamic cast 0 dynamic cast dynamic cast dynamic cast void somefunc( Base *obj ) if( Derived *dobj = dynamic cast< Derived* >( obj ) ) // do something with derived function } else // do something with base function } } void somefunc2( Base &obj ) try Derived &dobj = dynamic cast< Derived& >( obj ) ) // do something with derived function } catch( std::bad cast ) // do something with base function } dynamic cast bad cast <typeinfo> typeid typeid typeid

28 22 CHAPTER 2. CLASS typeid <typeinfo> typeid(type) typeid(object) typeid(expression) type info cout<<typeid(obj).name()<<endl; int n ; cout<<typeid( n ).name() ; // int cout<<typeid( 8.1 ).name() ; // double typeid typeid class Base /* */ class Derived : public Base /* */ Derived dobj ; Base *pb = &dobj ; cout<<typeid( *pb ).name()<<endl ; // Base typeid Base Derived typeid( pb ).name() Base* typeid type info type info type info class type info private: type info( const type info& ) ; type info& operator= (const type info& ) ; public: virtual type info() ; int operator== ( const type info& ) const ; int operator!= ( const type info& ) const ; const char * name() const ; type info type info typeid

29 Chapter 3 template 3.1 float (*fn)(float, int) = &power; float result=power<float, int>(a, n); 3.2 empty size() 0 empty list size 23

30 24 CHAPTER 3. TEMPLATE

31 Chapter 4 Standard Template Library (STL) 4.1 functional function objects C++ operator() struct myclass int operator() (int a) return a; } } myobject ; int x = myobject(0) ; // myobject <functional> unary function template<class Arg, class Result> struct unary function typedef Arg argument type ; typedef Result result type ; } ; operator() operator() 25

32 26 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) binary function template<class Arg1, class Arg2, class Result> struct binary function typedef Arg1 first argument type ; typedef Arg2 second argument type ; typedef Result result type ; } ; operator() operator() Operator classes Arithmetic operations plus template <class T> struct plus : binary function <T,T,T> T operator() (const T& x, const T& y) const return x+y ; } // plus example #include <iostream> #include <functional> #include <algorithm> using namespace std; int main () int first[]=1,2,3,4,5 int second[]=10,20,30,40,50 int results[5]; transform ( first, first+5, second, results, plus<int>() ); for (int i=0; i<5; i++) cout << results[i] << ; cout << endl; return 0; }

33 4.1. FUNCTIONAL 27 minus template <class T> struct minus : binary function <T,T,T> T operator() (const T& x, const T& y) const return x-y ; } multiplies template <class T> struct multiplies : binary function <T,T,T> T operator() (const T& x, const T& y) const return x*y ; } divides template <class T> struct divides : binary function <T,T,T> T operator() (const T& x, const T& y) const return x/y ; } modulus template <class T> struct plus : binary function <T,T,T> T operator() (const T& x, const T& y) const return x%y ; } negate template <class T> struct negate : unary function <T,T> T operator() (const T& x) const return -x ; }

34 28 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) // negate example int main () int numbers[]=10,-20,30,-40,50 transform ( numbers, numbers+5, numbers, negate<int>() ); for (int i=0; i<5; i++) cout << numbers[i] << ; return 0; } Comparison operations equal to template <class T> struct equal to : binary function <T,T,bool> T operator() (const T& x, const T& y) const return x==y ; } int main () pair<int*,int*> ptiter; int foo[]=10,20,30,40,50 int bar[]=10,20,40,80,160 ptiter=mismatch ( foo, foo+5, bar, equal to<int>() ); cout << First mistmatching pair is: << *ptiter.first; cout << and << *ptiter.second << endl; return 0; } First mismatching pair is: 30 and 40 no equal to greater less greater equal less equal Logical operations logical and template <class T> struct logical and : binary function <T,T,bool> T operator() (const T& x, const T& y) const return x&&y ; }

35 4.1. FUNCTIONAL 29 logical or logical not Adaptor and conversion functions Negators not1 negation template <class Predicate> unary negate<predicate> not1 (const Predicate& pred) return unary negate<predicate>(pred); unary negate template <class Predicate> class unary negate : public unary function <typename Predicate::argument type,bool> protected: Predicate fn; public: explicit unary negate ( const Predicate& pred ) : fn (pred) } bool operator() (const typename Predicate::argument type& x) const return!fn(x); } struct IsOdd : unary function<int,bool> bool operator() (const int& x) const return x%2==1; } int main () int values[] = 1,2,3,4,5 int cx; cx = count if ( values, values+5, not1(isodd()) ); cout << There are << cx << elements with even values.\n ; return 0; } There are 2 elements with even values. not2 negation

36 30 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) template <class Predicate> binary negate<predicate> not2 (const Predicate& pred) return binary negate<predicate>(pred); Parameter binders bind1st template <class Operation, class T> binder1st<operation> bind1st (const Operation& op, const T& x) return binder1st<operation>(op, typename Operation::first argument type(x)); } binder1st template <class Operation> class binder1st : public unary function <typename Operation::second argument type, typename Operation::result type> protected: Operation op; typename Operation::first argument type value; public: binder1st (const Operation& x, const typename Operation::first argument type& y) : op (x), value(y) } typename Operation::result type operator() (const typename Operation::second argument type& x) const return op(value,x); } int numbers[] = 10,20,30,40,50,10 int cx; cx = count if (numbers, numbers+6, bind1st(equal to<int>(),10) ); cout << There are << cx << elements that are equal to 10.\n ; There are 2 elements that are equal to 10. bind2nd

37 4.1. FUNCTIONAL 31 Conversors template <class Operation, class T> binder2nd<operation> bind2nd (const Operation& op, const T& x) return binder2nd<operation>(op, typename Operation::second argument type(x)); } ptr fun mem fun mem fun ref Instrumental types unary negate: Generate negation of unary function object class (class template) binary negate: Generate negation of binary function object class (class template) binder1st: Generate function object class with 1st parameter binded (class template) binder2nd: Generate function object class with 2nd parameter binded (class template) pointer to unary function: Generate unary function object class from pointer (class template) pointer to binary function: Generate binary function object class from pointer (class template) mem fun t: Generate function object class from parameterless member (pointer version) (class template) mem fun1 t: Generate function object class from single-parameter member (pointer version) (class template) const mem fun t: Generate function object class from const parameterless member (pointer version) (class template) const mem fun1 t: Generate function object class from single-parameter const member (pointer version) (class template) mem fun ref t: Generate function object class from parameterless member (reference version) (class template)

38 32 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) mem fun1 ref t: Generate function object class from single-parameter member (reference version) (class template) const mem fun ref t: Generate function object class from const parameterless member (reference version) (class template) const mem fun1 ref t: Generate function object class from single-parameter const member (reference version) (class template)

39 count() template <class InputIterator, class T> typename iterator traits<inputiterator>::difference type count ( InputIterator first, InputIterator last, const T& value ); [first,last) value (iterator traits<inputiterator>::difference type), ptrdiff t count if() template <class InputIterator, class T> typename iterator traits<inputiterator>::difference type count if ( InputIterator first, InputIterator last, Predicate pred ); [first,last) pred STL count if() operator() STL operator() STL operator() true false

40 34 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) const string ToothbrushCode( 0003 ); class IsAToothbrush public: bool operator() ( string& SalesRecord ) return SalesRecord.substr(0,4)==ToothbrushCode; } int main (void) list<string> SalesRecords; SalesRecords.push back( 0001 Soap ); SalesRecords.push back( 0002 Shampoo ); SalesRecords.push back( 0003 Toothbrush ); SalesRecords.push back( 0004 Toothpaste ); SalesRecords.push back( 0003 Toothbrush ); } int NumberOfToothbrushes(0); count if (SalesRecords.begin(), SalesRecords.end(), IsAToothbrush(), NumberOfToothbrushes); cout << There were << NumberOfToothbrushes << toothbrushes sold << endl; insert push back front back copy in copy out STL 4.4 vector<bool>? STL vector<bool> 1. STL

41 ITERATOR CONST ITERATOR REVERSE ITERATOR CONST REVER 2. bool STL C c T c operator[] vector<t> v ; T *p = &c[0]; // operator[] T* T bool vector<bool> bool bool vector bool 8 8 bool vector<bool> bitfield bool bool bool bool bool vector<bool> deque<bool>: deque vector reserve capacity deque<bool> STL bool deque deque<bool> bool C API bitset: bitset STL C++ STL STL iterator vector<bool> vector<bool> flip collection of bits bitset iterator const iterator reverse iterator const reverse iterator vector<t> insert erase iterator insert(iterator position, const T& x); iterator erase(iterator position); iterator erase(iterator rangebegin, iterator rangeend); iterator const iterator reverse iterator const reverse iterator const iterator iterator const reverse iterator reverse iterator

42 36 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) Figure 4.1:. iterator const reverse insert erase iterator iterator const reverse const iterator iterator reverse iterator iterator 28 iterator const iterator distance advance const iterator iterator const iterator iterator vector string const iterator iterator typedef deque<int> IntDeque ; typedef IntDeque::iterator Iter ; typedef IntDeque::const iterator ConstIter ; IntDeque d ; ConstIter ci ;... // ci d Iter i(d.begin()) ; // i d advance(i, distance<constiter>(i, ci)) ; // i ci // i ci const iterator const iterator iterator iterator const iterator iterator vector string deque

43 REVERSE ITERATOR BASE() ITERATOR reverse iterator base() iterator reverse iterator base() iterator vector<int> v; v.reserve(5); // 14 for(int i = 0 i 5; ++ i) // vector 1 5 v.push back(i); } vector<int>::reverse iterator ri = find(v.rbegin(), v.rend(), 3); // ri 3 vector<int>::iterator i(ri.base()); // i ri base vector Figure 4.2:. reverse iterator base() iterator rbegin() rend() begin() end() 1. reverse iterator ri ri.base() ri ri.base() ri.base() ri iterator 2. reverse iterator ri ri.base() ri ri.base() ri.base()

44 38 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) ri iterator v.erase((++ri).base()) ; // ri ri remove erase remove STL remove template<class ForwardIterator, class T> ForwardIterator remove(forwarditerator first, ForwardIterator last, const T& value); remove remove remove remove remove remove remove vector<int> v Figure 4.3: remove v. remove vector<int>::iterator newend( remove( v.begin(), v.end(), 99 ) ) ; v Figure 4.4: remove v. c++ STL remove v

45 REMOVE 39 Figure 4.5: STL remove v. v.erase( remove(v.begin(), v.end(), 99), v.end() ) ; list remove remove erase STL remove remove remove remove if unique unique list remove list::unique remove Widget Widget class Widget public:... bool iscertified() const ;... verctor<widget*> v ;... v.push back(new Widget) ;... v Widget erase-remove v.erase( remove if(v.begin(), v.end(), not1(mem fun(&widget::iscertified))), v.end() ) ; remove if v Widget remove if v

46 40 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL) Figure 4.6: remove if v. Figure 4.7: remove if v. remove remove if unique partition remove erase-remove Widget void delandnullifyuncertified(widget*& pwidget) // *pwidget // Widget if (!pwidget->iscertified()) // delete pwidget; pwidget = 0; } } for each(v.begin(), v.end(), // Widget delandnullifyuncertified); // v.erase(remove(v.begin(), v.end(), // v static cast<widget*>(0)), // 0 v.end()); // C++ remove

47 REMOVE 41 remove template<typename T> // RCSP = Reference Counting Smart Pointer class RCSP... typedef RCSP< Widget > RCSPW; // RCSPW = RCSP to Widget vector< RCSPW > v; // vector Widget... v.push back(rcspw(new Widget));... v.erase(remove if(v.begin(), v.end(), // Widget not1(mem fun(&widget::iscertified))), // v.end()); RCSP<Widget> Widget* Widget::isCertified Boost shared ptr

48 42 CHAPTER 4. STANDARD TEMPLATE LIBRARY (STL)

49 Bibliography [1] Stanley B. Lippman and Josée Lajoie C++ Primer 2002 [2] Scott Meyers Effective STL

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

FY.DOC

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

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

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_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++程序设计 - 字符串与格式化输入/输出

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

More information

untitled

untitled 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

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

CC213

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

More information

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

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

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

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. 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 - 物件導向編程精要.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

Strings

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

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

Strings

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

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

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

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

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

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

More information

新版 明解C言語入門編

新版 明解C言語入門編 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

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

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

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

More information

1 C++ 2 Bjarne Stroustrup C++ (system programming) 6 (infrastructure) C++ 7 Herb Sutter 8 C++ (efficiency) (flexibility) 9 (abstraction) (productivity

1 C++ 2 Bjarne Stroustrup C++ (system programming) 6 (infrastructure) C++ 7 Herb Sutter 8 C++ (efficiency) (flexibility) 9 (abstraction) (productivity 1 C++ 1 C++ Primer C++ (giantchen@gmail.com) 2012-7-11 Creative Commons - - 3.0 Unported (cc by-nc-nd) http://creativecommons.org/licenses/by-nc-nd/3.0/ 1 C++ 2009 Stanley Lippman C++ C++ Java/C#/Python

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

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

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

Microsoft Word - 970617cppFinalSolution.doc

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

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

CHAPTER VC#

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

More information

untitled

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

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

W. Richard Stevens UNIX Sockets API echo Sockets TCP OOB IO C struct C/C++ UNIX fork() select(2)/poll(2)/epoll(4) IO IO CPU 100% libevent UNIX CPU IO

W. Richard Stevens UNIX Sockets API echo Sockets TCP OOB IO C struct C/C++ UNIX fork() select(2)/poll(2)/epoll(4) IO IO CPU 100% libevent UNIX CPU IO Linux muduo C++ (giantchen@gmail.com) 2012-09-30 C++ TCP C++ x86-64 Linux TCP one loop per thread Linux native muduo C++ IT 5 C++ muduo 2 C++ C++ Primer 4 W. Richard Stevens UNIX Sockets API echo Sockets

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

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

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

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

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

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. 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# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii 前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii C# 7 More Effective C# C# C# C# C# C# Common Language Runtime CLR just-in-time

More information

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-065Big5 Title : Sun Certified Programmer for the Java 2 Platform, SE 6.0 Version : Demo 1 / 14 1. 35. String #name = "Jane Doe"; 36. int

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

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

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

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM CHAPTER 6 SQL SQL SQL 6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM 3. 1986 10 ANSI SQL ANSI X3. 135-1986

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

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 310-055Big5 Title : Sun Certified Programmer for the Java 2 Platform.SE 5.0 Version : Demo 1 / 22 1. 11. public static void parse(string str)

More information

contentGB.PDF

contentGB.PDF v i v xvii xvii xviii xviii xix xx xx xxi xxii xxiii xxiv xxvi xxvi 1 STL 001 1.1 STL 001 1.1.1 STL 003 1.1.2 STL C++ 003 vi STL 1.2 STL 004 1.3 GNU 007 1.4 HP STL 009 1.5 P.J. Plauger STL 010 1.6 Rouge

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

Chapter 1 What is Programing Paradigm 1

Chapter 1 What is Programing Paradigm 1 An Introduction to Programing Paradigm Chase Zhang May 8, 2013 Chapter 1 What is Programing Paradigm 1 CHAPTER 1. WHAT IS PROGRAMING PARADIGM 2 Definition from Wikipedia 1. Object-oriented programming/

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

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

Contents 1 深 圳 大 学 经 济 学 院 学 生 代 表 大 会 章 程 2 2 优 秀 毕 业 生 评 选 细 则 7 3 议 事 规 则 8 i

Contents 1 深 圳 大 学 经 济 学 院 学 生 代 表 大 会 章 程 2 2 优 秀 毕 业 生 评 选 细 则 7 3 议 事 规 则 8 i 深 圳 大 学 经 济 学 院 学 代 委 执 事 指 南 发 布 0.0.1 深 圳 大 学 经 济 学 院 学 代 委 2016 年 05 月 25 日 Contents 1 深 圳 大 学 经 济 学 院 学 生 代 表 大 会 章 程 2 2 优 秀 毕 业 生 评 选 细 则 7 3 议 事 规 则 8 i ii 深 圳 大 学 经 济 学 院 学 代 委 执 事 指 南, 发 布 0.0.1

More information

Microsoft Word - chap10.doc

Microsoft Word - chap10.doc 78 10. Inheritance in C++ 我 們 已 介 紹 了 物 件 導 向 程 式 的 第 一 個 主 要 特 性, 即 程 式 可 模 組 化 成 為 類 別 ( 物 件 ), 類 別 具 有 資 料 封 裝 的 特 性 接 下 來 我 們 要 介 紹 物 件 導 向 程 式 的 另 一 個 主 要 特 性, 那 就 是 類 別 具 有 繼 承 的 功 能 繼 承 就 是 重 複

More information

Microsoft PowerPoint - plan08.ppt

Microsoft PowerPoint - plan08.ppt 程 序 设 计 语 言 原 理 Principle of Programming Languages 裘 宗 燕 北 京 大 学 数 学 学 院 2012.2~2012.6 8. 面 向 对 象 为 什 么 需 要 面 向 对 象? OO 语 言 的 发 展 面 向 对 象 的 基 本 概 念 封 装 和 继 承 初 始 化 和 终 结 处 理 动 态 方 法 约 束 多 重 继 承 总 结 2012

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

概述

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

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

KillTest 质量更高 服务更好 学习资料   半年免费更新服务 KillTest 质量更高 服务更好 学习资料 http://www.killtest.cn 半年免费更新服务 Exam : 70-536Chinese(C++) Title : TS:MS.NET Framework 2.0-Application Develop Foundation Version : DEMO 1 / 10 1. Exception A. Data B. Message C.

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

untitled

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

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

IO

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

More information

EJB-Programming-4-cn.doc

EJB-Programming-4-cn.doc EJB (4) : (Entity Bean Value Object ) JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Session Bean J2EE Session Façade Design Pattern Session Bean Session

More information

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

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

More information

Microsoft PowerPoint - 10 模板 Template.pptx

Microsoft PowerPoint - 10 模板 Template.pptx 模板 Tempalte 泛型编程的需要 Why Templates? 设想你对整数类型实现了一个排序算法 : void sort(int *is,int n); 用该函数可以对实 复数或工资单排序吗? 模板可以复用源代码 - 泛型编程. inline void Swap( int &x, int &y){ int t = x; x = y; y =t; inline void Swap(double

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

untitled

untitled 1 Outline 類别 欄 (1) 類 類 狀 更 易 類 理 若 類 利 來 利 using 來 namespace 類 ; (2) namespace IBM class Notebook namespace Compaq class Notebook 類别 類 來 類 列 欄 (field) (property) (method) (event) 類 例 立 來 車 類 類 立 車 欄 料

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

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

untitled

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

More information

C

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

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

D C 93 2

D C 93 2 D9223468 3C 93 2 Java Java -- Java UML Java API UML MVC Eclipse API JavadocUML Omendo PSPPersonal Software Programming [6] 56 8 2587 56% Java 1 epaper(2005 ) Java C C (function) C (reusability) eat(chess1,

More information

EJB-Programming-3.PDF

EJB-Programming-3.PDF :, JBuilder EJB 2.x CMP EJB Relationships JBuilder EJB Test Client EJB EJB Seminar CMP Entity Beans Value Object Design Pattern J2EE Design Patterns Value Object Value Object Factory J2EE EJB Test Client

More information

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

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

More information

untitled

untitled 1 Outline ArrayList 類 列類 串類 類 類 例 理 MSDN Library MSDN Library 量 例 參 列 [ 說 ] [] [ 索 ] [] 來 MSDN Library 了 類 類 利 F1 http://msdn.microsoft.com/library/ http://msdn.microsoft.com/library/cht/ Object object

More information

第七讲 继承与多态

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

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

Microsoft PowerPoint - ch6 [相容模式]

Microsoft PowerPoint - ch6 [相容模式] UiBinder wzyang@asia.edu.tw UiBinder Java GWT UiBinder XML UI i18n (widget) 1 2 UiBinder HelloWidget.ui.xml: UI HelloWidgetBinder HelloWidget.java XML UI Owner class ( Composite ) UI XML UiBinder: Owner

More information

奥运风云榜(上).doc

奥运风云榜(上).doc ...1 1920...3 1896 2004...5...8...8 9... 11 8 9...13...14...16...20...31...36 TP10...39...46...47...49...49 I II...50 2004 2008...52...56...59...64...67 1500...68...69...70...71...76...82...86...89...92

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

epub83-1

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

More information

第一章 章标题-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

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

06-4.indd

06-4.indd 1 02 07 13 16 20 28 33 38 42 46 48 51 57 64 65 65 66 67 68 2 3 4 5 6 7 8 9 10 11 12 13 LL T : 14 LL T 15 16 扫描电子显微镜成像模拟的 MPI 及 OpenMP 并行化 17 18 19 20 21 22 ~ ~ ~ 23 24 ~ ~ ~ ~ ~ ~ ~ 25 26 27 28 29 图 3

More information

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

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

More information

untitled

untitled 1 Outline 料 類 說 Tang, Shih-Hsuan 2006/07/26 ~ 2006/09/02 六 PM 7:00 ~ 9:30 聯 ives.net@gmail.com www.csie.ntu.edu.tw/~r93057/aspnet134 度 C# 力 度 C# Web SQL 料 DataGrid DataList 參 ASP.NET 1.0 C# 例 ASP.NET 立

More information

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074>

<4D6963726F736F667420506F776572506F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074> 程 序 设 计 实 习 INFO130048 3-2.C++ 面 向 对 象 程 序 设 计 重 载 继 承 多 态 和 聚 合 复 旦 大 学 计 算 机 科 学 与 工 程 系 彭 鑫 pengxin@fudan.edu.cn 内 容 摘 要 方 法 重 载 类 的 继 承 对 象 引 用 和 拷 贝 构 造 函 数 虚 函 数 和 多 态 性 类 的 聚 集 复 旦 大 学 计 算 机 科 学

More information

无类继承.key

无类继承.key 无类继承 JavaScript 面向对象的根基 周爱 民 / aimingoo aiming@gmail.com https://aimingoo.github.io https://github.com/aimingoo rand = new Person("Rand McKinnon",... https://docs.oracle.com/cd/e19957-01/816-6408-10/object.htm#1193255

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

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