Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File.

Similar presentations


Presentation on theme: "Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File."— Presentation transcript:

1 Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File

2 Hung-Hsiang WuWindows Processing Design2 變數宣告與型態 變數名稱可以由英文字母的大小寫、底 線及數字所組成 變數名稱不得使用保留字 (ex: if) 英文字母的大小寫視為不同 (ex: Id,id) 不可使用中文當變數 (ex: 學生 ) 變數使用有意義的單字 (ex: student_id)

3 Hung-Hsiang WuWindows Processing Design3 變數宣告與型態 cont. Char ( -128~127) String (0~255) -> 此為 BCB 特有的 Long (-2,147,483,648~2,147,483,647) Float (1.2E-38~3.4E38) Double (2.2E-308~1.8E308) Bool (true or false)

4 Hung-Hsiang WuWindows Processing Design4 特殊運算子符號 算數運算子 (+,-,*,/) 關係運算子 (==,!=,>,>=) 邏輯運算子 (&&,||,!) -> : 取物件的屬性值 ( Label1->Caption) : : 範圍運算子 (Tform 1::btnClick)

5 Hung-Hsiang WuWindows Processing Design5 字串與數值的轉換 AnsiString 類別 AnsiString s1; 轉換函式 StrToInt(),IntToStr(),FloatToStr(),FloatToStr() Ex: StrToInt( “ 123 ” ),IntToStr(123); AnsiString 類別所建構的方法 Delete(),Insert(),IsEmpty(),ToInt(),Trim()..

6 Hung-Hsiang WuWindows Processing Design6 類別與物件的觀念 內建型態 builtin type (int, long, double) C 語言以函數 (function) 為單元 C++ 語言以類別 (Class) 為單元 類別 (Class) 包含資料與函數 結構 (struct) 包含資料 使用者定義型態 user-defined type

7 Hung-Hsiang WuWindows Processing Design7 類別與物件的觀念 cont. 類別宣告 class declaration class 類別名稱 { private: 定義私用成員 ; public: 定義公用成員 ; }

8 Hung-Hsiang WuWindows Processing Design8 類別與物件的觀念 cont. class student { int id; String name; public: void show(); }; void student::show() { ………..} id name

9 Hung-Hsiang WuWindows Processing Design9 建立新的專案 File -> News …

10 Hung-Hsiang WuWindows Processing Design10 WinMain 程式進入點

11 Hung-Hsiang WuWindows Processing Design11 Include Header File Include header file #include “ Unit2.h ” 相互使用表單之間的元件

12 Hung-Hsiang WuWindows Processing Design12 Include Header File cont.


Download ppt "Hung-Hsiang WuWindows Processing Design1 Chapter 3 基本觀念 變數宣告與型態 特殊運算子符號 字串與數值的轉換 類別與物件的觀念 建立新的專案 WinMain 程式進入點 Include Header File."

Similar presentations


Ads by Google