!249 第 八講 進階指標 講師 : 李根逸 (Ken-Yi Lee),
|
|
- 菊 闻
- 4 years ago
- Views:
Transcription
1 249 第 八講 進階指標 講師 : 李根逸 (Ken-Yi Lee), feis.tw@gmail.com
2 250 課程 大綱 陣列的複製 [P.252] 字串的特殊性 [P.255] const 修飾字 [P.256] 指標陣列 [P.257] 字串陣列 [P.258] 指標與 二維陣列 [P.260] 動態記憶體配置與釋放 C 語 言中動態記憶體的配置 [P.266] C 語 言中動態記憶體的釋放 [P.267]
3 int v[5]; int *vptr; v = v; // 語法錯誤 vptr = vptr; // 合法 v[0] = 1; // 合法 *vptr = 1; // 邏輯錯誤 v = vptr; // 語法錯誤 vptr = v; // 隱性轉型 (int (*)[5]) v (int [5]) vptr (int *) v[0] v[1] v[2] v[3] v[4] (int) 1 (int) 2 int v[5]; int *vptr = v; v[0] = 1; vptr[0] = 1; v[1] = 2; vptr[1] = 2; *vptr = 1; *v = 1; *(vptr+1) = 2; *(v+1) = 2; *(vptr) *(vptr+1) *(vptr+2) *(vptr+3) *(vptr+4) (int)?? (int)?? (int *) (int *) (int *) (int *) (int *) vptr[0] *v vptr[1] *(v+1) (int)?? vptr[2] vptr[3] vptr[4] *(v+2) *(v+3) *(v+4) 251
4 252 陣列的複製 因為複製陣列需要 比較多的空間和時間, 所以陣列型態的資料並不能 用直接的 用指定運算 子複製 : int v[5] = {1, 2, 3, 4, 5}; int n[5]; n = v; // [ 編譯失敗 ] 若真的要複製請參考 P.203 雖然陣列型態無法放在指定運算 子左 方, 但是指標變數可以 : int *p = v; // v 會從 int [5] 隱性轉型成 int * // 然後指向 &v[0] for (int i = 0; i < 5; ++i) { printf( %d, p[i]); } p 彷彿就是 v 一樣 (shallow copy) 在函式間傳送陣列時就是使 用這招 範例 copy.cpp
5 253 範例 字串複製 試寫 一函式將 一字串內容複製到另 一字元陣列中 void strcpy(char *dst, const char *src); 提 示 : 字串是個以 \0 字元表 示結尾的字元陣列 要真的 用迴圈複製 (deep copy): dst[0] = src[0]; for (int i = 1; src[i-1] = 0 ; i++) { dst[i] = src[i]; } 補充 使 用指標的算術運算 : while ( (*dst++ = *src++) = \0 ) {} 範例 strcpy.cpp
6 補充 泡沫排序法 試寫 一名為 bubblesort 的函式, 將傳 入 大 小為 size 的整數陣列 array 內容, 變成由 小到 大排序 : 例如 : void bubblesort(int *array, int size); int values[3] = {3, 4, 1}; bubblesort(values, 3); printf( %d %d %d\n, values[0], values[1], values[2]); 預期結果 :
7 255 字串的特殊性 str1 (char [6]) char str1[6] = test ; // 特殊的初始化 方式 str1[0] str1[1] str1[2] str1[3] str1[4] (char) t (char) e (char) s (char) t (char) \0 str1[5] (char) \ (char (*)[6]) (char *) (char *) (char *) (char *) (char *) (char *) str2 (char *) char *str2 = test ;// 在記憶體裡哪裡? str2[0] str2[1] str2[2] str2[3] str2[4] (char) t (char) e (char) s (char) t (char **) (char *) (char *) (char *) (char *) (char *) 危險 勿修改內容 (char) \0 const char *str3 = test ; // 使 用 const 修飾字
8 256 const 修飾字 變數或函式宣告時可以在資料型態前加上 const 修飾詞, 之後此變數的值初始化後就無法直接改變 嘗試使 用賦值運算 子 (=) 改變宣告為 const 的變數值時會造成編譯錯誤 ( 無法產 生執 行檔 ) const int N = 10; N = 20; // [ 編譯失敗 ] 使 用 const 修飾字可以避免不 小 心修改到不應修改的變數值, 此外也有機會可以增加程式的效率
9 257 指標陣列 指標陣列顧名思義就是指標所構成的陣列 : int *p[5]; // 宣告 大 小為 5 的陣列 p, 元素型態為 int * p (int *[5]) p[0] p[1] p[2] p[3] p[4] (int *)?? (int *)?? (int *)?? (int *)?? (int *)?? (int *(*)[5]) (int **) (int **) (int **) (int **) (int **) 指標陣列有什麼 用途?
10 258 字串陣列 字串陣列是 一個指向 char * 的指標陣列 : // 宣告 大 小為 5 的陣列 p, 元素型態為 char * char *p[5]; char str[] = test ; p[0] = str; p (char *[5]) (char *(*)[5]) str (char [5]) p[0] p[1] p[2] p[3] p[4] (char *) (char *)?? (char *)?? (char *)?? (char **) (char **) (char **) (char **) (char **) (char ) t (char ) e (char ) s (char ) t (char ) \0 (char *)?? (char (*)[5]) (char *) (char *) (char *) (char *) (char *)
11 const char *str[4] = { This, is, a, book }; 259 str[0] str[1] str[2] str[3] str (const char *[4]) (char *(*)[4]) (const char *) (const char *) (const char *) (char **) (char **) (char **) (char **) (const char ) T (const char ) h (const char ) i (const char *) (const char ) s (const char ) \0 (const char ) i (const char ) s (const char ) \ (const char ) a (const char ) \ (const char ) b (const char ) o (const char ) o (const char ) k (const char ) \
12 260 指標與 二維陣列 二維陣列是元素型態為陣列的陣列 : int p[5][2]; // 宣告 大 小為 5 的陣列 p, 元素型態為 int [2] p p[0] p[1] p[2] p[3] p[4] (int [5][2]) (int [2]) (int [2]) (int [2]) (int [2]) (int [2]) (int (*)[5][2]) (int (*)[2]) (int (*)[2]) (int (*)[2]) (int (*)[2]) (int (*)[2]) p[0][0] p[0][1] p[1][0] p[1][1] p[2][0] p[2][1] p[3][0] p[3][1] p[4][0] p[4][1] (int)?? (int)?? (int)?? (int)?? (int)?? (int)?? (int)?? (int)?? (int)?? (int)?? (int *) (int *) (int *) (int *) (int *) (int *) (int *) (int *) (int *) (int *) 思考 可以寫 int *v = p[0]; 嗎? 可以寫 int **v = p; 嗎?
13 char str[4][5] = { This, is, a, book }; 261 str[0] str[1] str[2] str[3] str (char [4][5]) (char [5]) (char ) T (char [5]) (char [5]) (char ) h (char ) i (char [5]) (char ) s (char ) i (char ) s (char ) \0 (char ) \0 (char ) \0 (char ) \ (char ) a (char ) \0 (char ) \0 (char ) \0 (char ) \ (char ) b (char ) o (char ) o (char ) k (char ) \
14 const char *str1[4] = { This, is, a, book }; char str2[4][5] = { This, is, a, book }; printf( %s\n, str1[1]); printf( %s\n, str2[1]); printf( %c\n, str1[0][0]); printf( %c\n, str2[0][0]); str1[3] = pig ; str2[3] = pig ; str1[3][0] = l ; str2[3][0] = l ; 262
15 263 補充 字串轉換函式 C 標準函式庫在 <stdlib.h> 中提供了許多字串轉換相關的函式 : int atoi(const char*) 將字串內容轉換成 int 值後傳回 int num = atoi( 30 ); float atof(const char*) 將字串內容轉換成 float 值後傳回 float num = atoi( 30.5 ); long atol(const char*) 將字串內容轉換成 double 值後傳回 double num = atol( 30.5 );
16 264 補充 main 函式的參數 標準 main 的函式宣告 : int main(int argc, char* argv[]) {... return 0; } main 函式有兩個參數 : argc: 程式在執 行時具有幾個參數 argv: 字串指標陣列 argv[0] : 第 一個參數內容 ( 字串 ) [ 程式本 身的執 行路徑 ] 將程式編譯後, 可以在指令列模式 (cmd) [MS-DOS] 執 行執 行檔時加 入參數 Microsoft Windows 中將檔案拖曳到執 行檔上時, 會將檔案路徑作為 main 參數傳 入
17 265 範例 main 的引數 試寫 一程式, 讓使 用者使 用 system 呼叫下列指令後, 顯 示指令參數中的最 大值 : system( main 3 4 ); 補充 : 在 開始 > 執 行 內輸 入 cmd 可以啟動 MS-DOS 指令列模式 在 MS-DOS 指令列模式下, 可以 用 cd 指令切換 目錄 範例 main.cpp 試寫 一程式, 在 Mircrosoft Windows 中拖曳檔案到執 行檔後顯 示檔案路徑 範例 path.cpp
18 266 動態記憶體的配置 寫 一個函式幫我配置記憶體? 能找到未使 用的記憶體位址 讓以後的變數不會重複使 用到 可在動態記憶體池內配置與管理記憶體的函式 : #include <stdlib.h> void *malloc(size_t size); malloc 在記憶體池中找到 size 個位元組 大 小的未使 用記憶體空間, 註冊後並回傳指向該空間的位址 malloc 的回傳值型態是任意資料型態 的位址 (void *) int *f(int N) { int a[n]; return a; } 函式回傳值型態不能是陣列 int *f(int N) { int *p = (int *)malloc( N*sizeof(int)); return p; } 範例 malloc_3.cpp
19 267 動態記憶體的釋放 程式在宣告變數時會依照資料型態 自動配置記憶體空間 在變數 生命週期結束時, 該空間 自動的被釋放 但是在使 用 malloc 這類函式動態配置記憶體後, 該空間會 一直被佔 用直到 free 函式被呼叫 #include <stdlib.h> void free(void *ptr); #include <stdlib.h> void func() { int *buf = (int*)malloc(100*sizeof(int)); /* Do something */ free(buf); return; } #include <stdlib.h> void func() { int buf[100]; /* Do something */ return; } 範例 malloc_4.cpp
20 268 範例 可變 大 小的陣列 試寫 一程式讓使 用者輸 入任意個學 生成績, 直到使 用者輸 入負數時停 止 輸 入完後請印出所有學 生的成績 這裡我們沒有限制學 生個數, 無法預設最 大個數 我們必須隨著使 用者輸 入的成績越多, 而產 生越 大的陣列去存 範例 malloc.cpp
21 269 範例 儲存字串 試寫 一程式讓使 用者輸 入五個名字後, 讓使 用者輸 入編號查詢姓名 : 請輸 入第 1 個名字 : Lee 請輸 入第 2 個名字 : Lin 請輸 入第 3 個名字 : Huang 請輸 入第 4 個名字 : Chiang 請輸 入第 5 個名字 : Wang 請輸 入你要查詢的編號 : 3 第 3 個名字是 Huang 請輸 入你要查詢的編號 : 5 第 5 個名字是 Wang
22 270
23 271
24 272
!194 課程 大綱 陣列介紹 [P.195] 陣列的使 用 [1] - 多個同型變數 [P.196] 陣列的初始化 [P.198] 陣列的使 用 [2] - 循序存取 [P.199] 陣列的使 用 [3] - 隨機存取 [P.200] 陣列的複製 [P.203] 在函式間傳送陣列 [P.204]
!193 第六講 陣列與字串 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com !194 課程 大綱 陣列介紹 [P.195] 陣列的使 用 [1] - 多個同型變數 [P.196] 陣列的初始化 [P.198] 陣列的使 用 [2] - 循序存取 [P.199] 陣列的使 用 [3] - 隨機存取 [P.200] 陣列的複製 [P.203] 在函式間傳送陣列
More informationMicrosoft PowerPoint - STU_C_Lang_CH13.ppt
第 13 章 動態配置記憶體 程式設計與生活 - 使用 C 語言 Shi-Huang Chen Spring 2013 第 13 章 動態配置記憶體 13-1 記憶體配置函式 malloc( ) 13-2 動態配置結構陣列 配置記憶體 預估需求數量的範圍是一項不容易的學問 例 : 大到預估今年國家預算, 小到預估櫥窗裡展示的毛線衣, 需要多少磅毛線才能織成 撰寫程式時, 一樣無法預估程式執行所需的記憶體空間
More informationC/C++ Programming
265 第九講 結構 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com 266 課程 大綱 結構 (struct) 結構宣告 [P.267] 結構定義 [P.268] 結構變數宣告 [P.269] 結構變數的初始化 [P.272] 存取結構成員 [P.244] 傳送 大型資料型態參數 [P.277] 267 結構宣告 結構是 一種衍 生的 自訂資料型態,
More informationC++ 程式設計
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 informationMicrosoft PowerPoint - C_Structure.ppt
結構與其他資料型態 Janet Huang 5-1 結構的宣告 struct 結構名稱 struct 結構名稱變數 1, 變數 2,, 變數 m; struct 結構名稱 變數 1, 變數 2,, 變數 m; student; student; 5-2 1 結構變數初值的設定 struct 結構名稱 struct 結構名稱變數 = 初值 1, 初值 2,, 初值 n student="janet","1350901",100,95
More informationC 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 informationCC213
: (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語言重點複習
鏈結串列自編教材 ( 一 ) 本教材 ( 一 ) 目標問題 : 每次以亂數產生一 [0,1000] 之整數值, 若該值 >100, 則以同方式繼續產生下一亂數值, 若該值
More informationMicrosoft PowerPoint - Class5.pptx
C++ 程式初探 V 2015 暑期 ver. 1.0.1 C++ 程式語言 大綱 1. 大量檔案讀取 & 計算 2. 指標 3. 動態記憶體 & 動態陣列 4. 標準函式庫 (STL) vector, algorithm 5. 結構與類別 2 大量檔案讀取 & 計算 若目前有一個程式將讀取純文字文件 (.txt) 中的整數, 並將該文件中的整數有小到大排序後, 儲存到另外一個新的純文字件中 假設有
More informationC/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 informationuntitled
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 informationC/C++基礎程式設計班
C/C++ 基礎程式設計 指標 (Pointer) 講師 : 張傑帆 CSIE, NTU 瘋到自以為能改變世界的人, 就能改變世界 The people who are crazy enough to think they can change the world are the ones who do.-steve Jobs 課程大綱 指標簡介 陣列與指標 動態記憶體配置 指標宣告進階 指標 用途
More information新版 明解C言語入門編
328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66
More information新・明解C言語入門編『索引』
!... 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 informationC/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運算子多載 Operator Overloading
函數樣板 (Function Template) 與 類別樣板 (Class Template) 講師 : 洪安 1 資料結構與 C++ 程式設計進階班 為何需要通用函數? (1/2) int abs(int x) { return (x>0)?x:-x; 取名困難不好記 float fabs(float x) { return (x>0)?x:-x; complex cabs(complex x)
More informationuntitled
串 串 例 : char ch= a ; char str[]= Hello ; 串 列 ch=getchar(); scanf( %c,&ch); 串 gets(str) scanf( %s,str); 8-1 數 ASCII 例 : char ch= A ; printf( %d,ch); // 65 A ascii =0x41 printf( %c,ch); // A 例 : char ch;
More information第3章.doc
3 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 informationMicrosoft 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
資料庫管理程式 ( 補充教材 -Part2) 使用 ADO.NET 連結資料庫 ( 自行撰寫程式碼 以實現新增 刪除 修改等功能 ) Private Sub InsertButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InsertButton.Click ' 宣告相關的 Connection
More informationCC213
: (Ken-Yi Lee), E-mail: feis.tw@gmail.com 9 [P.11] : Dev C++ [P.12] : http://c.feis.tw [P.13] [P.14] [P.15] [P.17] [P.23] Dev C++ [P.24] [P.27] [P.34] C / C++ [P.35] 10 C / C++ C C++ C C++ C++ C ( ) C++
More information奇特的一生(Эта странная жизнь)
凡 剑 (Ken777) 藏 书 奇 特 的 一 生 苏 格 拉 宁 著 侯 焕 闳 唐 其 慈 译 外 国 文 学 出 版 社 一 九 八 三 年 北 京 ДАНИИЛ ГРАНИН ЗТА СТРАННАЯ ЖИЗНЬ 据 Д. ГРАНИН: ВЬІБОР ЦЕЛИ (СОВЕТСКИЙ ПИСАТЕЛЬ, ЛЕНИНГРАДСКОЕ ОТДЕЛЕНИЕ,1975) 译 出 封 面 扉 页 :
More informationC 語言—陣列及字串
10/16 系程主講人 : 荊輔翔 概論 陣列 陣列是一個具有索引 (index) 性質的連續資料儲存空間集合 陣列中每一個資料儲存空間稱之為陣列元素 (array element); 它們都具有相同的資料名稱 資料型態 及空間大小 ; 但存取它們時則須藉由索引 ( 或稱註標 ) 來區別辨識 索引代表資料在陣列中的相對位址 ( 其計數由 0 開始, 其餘累加類推 ), 且須由中括號 [ ] 涵蓋之
More informationCHAPTER 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 informationC/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 informationFY.DOC
高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主
More informationC++
第五講 泛型程式設計 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com 130 課程 大綱 模版 (template) 簡介實作多個相似內容的函式函式模版類別模版 自製陣列模版 static 的 用法修飾全域變數或 一般函式修飾區域變數修飾類別成員 C++ STL 的陣列模版 (std::vector) 131 實作多個相似內容的函式 [1] 寫 C/C++
More informationC/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 information1
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 informationMicrosoft Word - part doc
3 指標與陣列 3-1 指標與一維陣列 3-2 指標與二維陣列 3-3 陣列指標 3-4 為什麼 parr 等同於 *parr? 3-5 指向陣列的指標 3-6 多重指標 3-7 命令列引數 3-8 除錯題 3-9 問題演練 3-10 程式實作 32 Part 1 C 程式語言篇 指標其實就是一位址 陣列的名稱, 表示此陣列第一個元素的位址, 所以它也是指標 由此可知, 指標與陣列的關係是很密切的
More informationC/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 information2013 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!49 第 二講 資料型態 運算子與表示式 講師 : 李根逸 (Ken-Yi Lee),
!49 第 二講 資料型態 運算子與表示式 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com !50 課程 大綱 資料型態 [P.51] C/C++ 內建的常 見資料型態 [P.52] 使 用 sizeof 看 大 小 [P.53] 變數宣告 [P.54] 不同資料型態間的差異 [P.55] 整數 (short int, int, long int)
More informationMicrosoft Word - ¤W½Ò¤º®e RTF
(variable) &( ) ( ) 0 9 A...Z a z under line( _ ) 1) (A...Z a z) 2) case sensitive 3) C/C++ (reserved word or key word) 1, 2,.., n char ch; int m; int n; int m, n; // float f = 10.0; // double d =f * 10.0;
More information踏出C++的第一步
踏出 C++ 的第一步 講師 : 洪安 1 已經學會的 C 語言基本概念 基本資料型態 變數 基本輸入輸出 控制敘述 選擇控制 迴圈 陣列 函式 指標 字元與字串 結構 檔案處理 2 C v.s. C++ C 函數 程序式語言 Procedural language 結構化程式設計 Structured programming 演算法 Top-down C++ 類別 物件導向程式設計 Object-Oriented
More informationMicrosoft PowerPoint - 07-overloaded.ppt
Overloaded Functions 前言 處理多載函式宣告的規則 處理多載函式呼叫的規則 多載函式與 scope 函式呼叫的議決 前言 C 語言規定 : 函式的名稱不可相同 這樣的規定使得我們必須為功能相近但參數型態相異的函式取不同的名稱, 譬如 : int imax (int, int); double dmax (double, double ); // max function for
More informationThe golden pins of the PCI card can be oxidized after months or years
Q. 如何在 LabWindows/CVI 編譯 DAQ Card 程式? A: 請參考至下列步驟 : 步驟 1: 安裝驅動程式 1. 安裝 UniDAQ 驅動程式 UniDAQ 驅動程式下載位置 : CD:\NAPDOS\PCI\UniDAQ\DLL\Driver\ ftp://ftp.icpdas.com/pub/cd/iocard/pci/napdos/pci/unidaq/dll/driver/
More informationC/C++基礎程式設計班
C/C++ 基礎程式設計 C++: 物件的使用 參考 重載函式 成就別人認為不可能的事 Do what nobody else considered possible. -Steve Jobs 講師 : 張傑帆 CSIE NTU C++ 相較於 C 的特色 向下相容 在 C 語言中, 我們學了許多程式語法, 所有學過的東西, 在 C++ 中都可以使用 高階的程式描述方式 更利於用來開發大型專案, 讓程式設計師在分工時更能快速的開發程式,
More informationC++ 程序设计 告别 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1
C++ 程序设计 告别 OJ1 - 参考答案 MASTER 2019 年 月 3 日 1 1 INPUTOUTPUT 1 InputOutput 题目描述 用 cin 输入你的姓名 ( 没有空格 ) 和年龄 ( 整数 ), 并用 cout 输出 输入输出符合以下范例 输入 master 999 输出 I am master, 999 years old. 注意 "," 后面有一个空格,"." 结束,
More information附錄C.doc
C C C-1 C -2 C -3 C -4 C -5 / C -6 2 C/C++ C-1 FILE* fopen(const char* filename, const char* mode) filename NULL FILE* freopen(const
More informationC
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 informationExcel VBA Excel Visual Basic for Application
Excel VBA Jun5,00 Sub 分頁 () Dim i As Integer Dim Cname As String Dim Code As Variant Set score=thisworkbook.sheets("sheet") Code=Array(" 專北一 "," 專北二 "," 專北三 "," 專桃園 "," 專桃竹 "," 專中苗 ", " 專台中 "," 專台南 ","
More information90 課程 大綱 條件判斷 : if ( 表 示式 ) {... } [P.91] 如果表 示式成 立就... if ( 表 示式 ) {... } else {... } [P.93] 如果表 示式成 立就... 否則就.. C / C++ 的複合指定與遞增遞減運算 子 [P.96] 重複執 行
89 第三講 程式流程控制 ( 上 ) 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com 90 課程 大綱 條件判斷 : if ( 表 示式 ) {... } [P.91] 如果表 示式成 立就... if ( 表 示式 ) {... } else {... } [P.93] 如果表 示式成 立就... 否則就.. C / C++ 的複合指定與遞增遞減運算
More informationepub 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新版 明解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 informationint *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 informationMicrosoft Word - ACL chapter02-5ed.docx
第 2 章神奇的質數 2.1.1 什麼是質數 1 1 1 打下好基礎 - 程式設計必修的數學思維與邏輯訓練 1 1 0 10 2 3 5 7 4 6 8 9 10 4 10000 1229 1000 168 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131
More informationMicrosoft PowerPoint - Bronson-v3-ch07.ppt [相容模式]
C++ FOR ENGINEERS AND SCIENTISTS THIRD EDITION Chapter 7 Arrays Objectives 2 In this chapter, you will learn about: One-dimensional arrays 一維陣列 Array initialization 陣列起始化 Declaring and processing two-dimensional
More informationC/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 informationMicrosoft PowerPoint - 08_陣列與函式.pptx
1 2 Outline 二維與多維陣列 Lecture 08 多維陣列函式 標準函式庫 函式簡介 一維陣列 二維陣列與多維陣列 陣列為多個同一型態變數之組合 int a[10]; 可存放 10 個整數資料的陣列, 可視為 10 個變數排成一個隊伍, 並給每一個變數一個編號, 自 0 號開始 至 9 號為止 a[0], a[1], a[2], a[],, a[9] 5 6 二維陣列的宣告 陣列為多個同一型態變數之組合
More information新・解きながら学ぶ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 informationMicrosoft Word - 投影片ch06
Java2 JDK5.0 教學手冊第三版洪維恩編著博碩文化出版書號 pg20210 第六章陣列 本章學習目標認識陣列與一般資料型態的不同認識一維與二維陣列學習陣列的應用 陣列 6-2 6.1 一維陣列 一維陣列 (1-dimensional array) 可以存放多個相同資料型態的資料 6.1.1 一維陣列的宣告與記憶體的配置 要使用陣列必須經過兩個步驟 :(1) 宣告陣列 (2) 配置記憶體給該陣列
More informationuntitled
MPICH anzhulin@sohu.com 1 MPICH for Microsoft Windows 1.1 MPICH for Microsoft Windows Windows NT4/2000/XP Professional Server Windows 95/98 TCP/IP MPICH MS VC++ 6.x MS VC++.NET Compaq Visual Fortran 6.x
More informationMicrosoft Word - ch doc
C 與 C++ 的差異 18 18.1 C 與 C++ 的差異簡介 前一章己經知道 C 和 C++ 是使用不同的方式來處理格式化輸出入 C++ 是 C 語言的超集合, 因此 C 語言的相關語法及函式也可以在 C++ 中使用, 下表我們列出 C 語言與 C++ 的差異處 : 註解 功能 C 語言 C++ 語言 變數宣告 資料型別 多載函式或多載運算子 inline 函式 常數定義 /* */ 為單行註解
More information!153 第五講 函式 講師 : 李根逸 (Ken-Yi Lee),
153 第五講 函式 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com 154 課程 大綱 函式宣告 [P.155] 函式呼叫 [P.156] C 標準函式庫 [P.157] 數學函式庫 [P.158] 函式定義 [P.160] 定義數學函式 [P.163] 定義模組化函式 [P.166] 變數可視範圍 [P.167] 在 for 的 小括號內宣告變數
More informationPowerPoint Presentation
語法復習 NTU CSIE 張傑帆 整合開發環境 NTU CSIE 張傑帆 C++ 開發工具 整合式開發環境 (Integrated Development Environment) 簡稱 IDE 是整合編輯 編譯 測試 除錯 與執行等功能的程式開發軟體 例如 Borland 公司的 C++ Builder IBM 公司的 VisualAge C++ Microsoft 公司的 Visual C++
More informationMicrosoft PowerPoint - 13_指標、資料傳遞2.pptx
1 2 指標 Lecture 13 指標函式呼叫的資料傳遞 (III) 傳址指標與陣列 Pointer 3 4 指標 / 指位器 (Pointer) 變數 int a; 整數型別, 名稱為 a 變數是為了使用記憶體資源來儲存資料與進行運算 所有的變數都佔有記憶體空間 記憶體 可視為一個很大的一維陣列, 單位是 byte 問題 一個 4KB 的電腦, 其記憶體位置 ( 編號 ) 從 0 至? 4 x
More informationC 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 information1 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 informationPowerPoint Presentation
Chapter 7 Pointers ( 指標 ) 1 Outline 7.1 Introduction 7.2 Pointer Variable Definitions and Initialization 7.3 Pointer Operators 7.4 Calling Functions by Reference 7.5 Using the const Qualifier with Pointers
More informationC/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 informationC Pointers
指標 (pointer) 是 C 程式語言最強大的功能之一, 我們將在本章中討論 指標能讓程式模擬傳參考呼叫, 以及產生和操作動態的資料結構, 亦即在執行時期會增大和減小的資料結構, 如鏈結串列 (linked lists) 佇列 堆疊和樹 第十章將討論使用指標的結構 第十二章則介紹動態記憶體管理 (dynamic memory management) 技術, 以及一些產生和使用動態資料結構的例子
More informationCC213
: (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 informationMicrosoft PowerPoint - 04-array_pointer.ppt
Array 與 Pointer Array Dynamical Memory Allocation Array( 陣列 ) 陣列是用來存放同樣型態的資料陣列的大小必須在程式中預先設定在程式執行中, 陣列的大小無法改變陣列中的資料是透過索引 (index) 來存取 一維陣列的宣告 type array_name[array_size]; int iarray[100]; /* an integer array
More information105Tr_CIS1
准考證號碼 : 國立臺中教育大學 105 學年度學士班日間部轉學招生考試 計算機概論試題 適用學系 : 資訊工程學系二 三年級 一 選擇題 (40%, 每題 2%) 1. 在物件導向程式設計中, 一個抽象類別 (Abstract Class) 為 A. 一個沒有方法 (method) 的類別 B. 一個不能被繼承 (inherit) 的類別 C. 一個不能被實體化 (instantiated) 的類別
More information單步除錯 (1/10) 打開 Android Studio, 點選 Start a new Android Studio project 建立專案 Application name 輸入 BMI 點下 Next 2 P a g e
Android Studio Debugging 本篇教學除了最基本的中斷點教學之外, 還有條件式中斷的教學 條件式中斷是進階的除錯技巧, 在某些特定情況中, 我們有一個函數可能會被呼叫數次, 但是我們只希望在某種條件成立時才進行中斷, 進而觀察變數的狀態 而條件式中斷這項技巧正是符合這項需求 本教學分兩部分 單步除錯 (Page2~11, 共 10) 條件式中斷點 (Page12~17, 共 6)
More informationMicrosoft 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 informationC/C++ Basics
第 十章 檔案輸入與輸出 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com 265 課程 大綱 與作業系統或其他軟體溝通 (API) [P267] 檔案相關函式表 [P268] 開啟與關閉檔案 (fopen, fclose) 讀寫純 文字檔 (fscanf, fprintf) 讀寫 二進位檔 (fread, fwrite) 前置處理器
More informationC/C++ Programming
!281 第 十講 檔案輸入與輸出 講師 : 李根逸 (Ken-Yi Lee), E-mail: feis.tw@gmail.com !282 課程 大綱 與作業系統或其他軟體溝通 (API) [P.283] 檔案相關函式表 [P.284] 開啟與關閉檔案 (fopen, fclose) 讀寫純 文字檔 (fscanf, fprintf) 讀寫 二進位檔 (fread, fwrite)
More informationuntitled
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 informationScott 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新・解きながら学ぶ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 informationC/C++基礎程式設計班
C/C++ 基礎程式設計 字元與字串 講師 : 張傑帆 CSIE, NTU 人的出身並不重要, 你拿時間來做什麼才重要 It s not who you were at birth that matters, but what you do with the time you are given.-steve Jobs 課程大綱 字元 字串 作業 字元 在電腦的世界裡, 所有的一切都是以 0 與 1
More informationMicrosoft 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_汪_文前新ok[3.1].doc
普 通 高 校 本 科 计 算 机 专 业 特 色 教 材 精 选 四 川 大 学 计 算 机 学 院 国 家 示 范 性 软 件 学 院 精 品 课 程 基 金 青 年 基 金 资 助 项 目 C 语 言 程 序 设 计 (C99 版 ) 陈 良 银 游 洪 跃 李 旭 伟 主 编 李 志 蜀 唐 宁 九 李 涛 主 审 清 华 大 学 出 版 社 北 京 i 内 容 简 介 本 教 材 面 向
More information<4D F736F F F696E74202D FB5F8B3A5A142B8EAAEC6B6C7BBBCA142BB50C0C9AED7BEDEA7402E >
1 2 回顧 指標與其算術運算 指標可類比於變數住的房間號碼 指標可以當陣列使用, 也可說指標可用來當陣列的別名 陣列的名稱本身可視為指標 int a[] = {1,2,,4,5; int *b = a; // 此時 b 記得 1 所住的房間號碼 cout
More informationPython a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2
Chapter 02 變數與運算式 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.2.3 type 2.2.4 2.3 2.3.1 print 2.3.2 input 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 + 2.4.6 Python Python 2.1 2.1.1 a p p l e b e a r c 65438790
More information3.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 informationC/C++基礎程式設計班
C/C++ 基礎程式設計 字元與字串 講師 : 張傑帆 CSIE, NTU 人的出身並不重要, 你拿時間來做什麼才重要 It s not who you were at birth that matters, but what you do with the time you are given.-steve Jobs 課程大綱 字元 字串 作業 字元 在電腦的世界裡, 所有的一切都是以 0 與 1
More information(Microsoft Word - eval\251Mresult\252\272\245\316\252k.doc)
eval 和 result 函式用法 編寫者 :Yi-Yu 日期 :05/26/2011 原著 :T.Issariyakul and E. Hossain 參考資料 :Introduction to Network Simulator NS2 參考範例 :Ns by Example 內 Linkage 範例 學習目的 : 瞭解 eval 和 result 函式用法差異 eval 和 result 函式很容易混淆,
More informationC/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 informationMicrosoft PowerPoint - Class2.pptx
C++ 程式初探 II 2015 暑期 C++ 程式 II 大綱 1. 變數 2. 運算式 3. 輸出 4. 條件判斷 5. 迴圈 6. 陣列 2 基本變數型態 整數 位元組 浮點數 位元組 字元 位元組 short 2 float 4 char ( 整數 ) 1 int 2 (4) double 8 long 4 (8) long double 8(10) 位元組 整數値域 浮點數値域 準確度 1-128
More information第7章-并行计算.ppt
EFEP90 10CDMP3 CD t 0 t 0 To pull a bigger wagon, it is easier to add more oxen than to grow a gigantic ox 10t 0 t 0 n p Ts Tp if E(n, p) < 1 p, then T (n) < T (n, p) s p S(n,p) = p : f(x)=sin(cos(x))
More informationCHAPTER 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 information51 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 informationC 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 informationX6-04_How_do_I_write_a_com_port_communicate_program_of_XPAC_tc
Author WeiKai Version 1.0.0 Date 2013/4/14 Page 1/11 我如何在 XPAC 上建立一個 COM port 通訊程式 Applies to: Platform OS version XPAC utility version XPAC series All versions (WinCE6) All versions XPAC SDK 提供 XPAC 結合
More information( CIP ) /. :, ISBN C CIP ( 2006 ) : : : : : : : : : 5, : ( ), ( ), ( ) : 0
F U Z H I L I N G D A O Y I S H U / ( CIP ) /. :, 2006. 8 ISBN 7-80206 - 301-9.... C933. 2 CIP ( 2006 ) 100377 : : : : : : : : : 5, 100062 :010-67078234 ( ),67078945( ), 67078235 ( ) : 010-67078227, 67078233,
More informationC 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投影片 1
平行運算簡介 / 實例操作企鵝也會的 MPICH 研究員 : 鄧偉華 wade@nchc.org.tw 什麼是平行計算 傳統 : 單一程序 單一 CPU 什麼是平行計算 ( 續 ) 平行計算 程序切割 多 CPUs 為什麼要平行計算 簡省時間 解決大型問題 即時性 使用更多來自網路上的資源 使用大量 便宜 PCs 取代超級電腦 記憶體不足 平行計算種類 Flynn's taxonomy 多處理器架構
More information我的生命哲學 五觀三一 陳學霖
無 可 取 代 的 寶 石 商 設 系 1011413031 吳 孟 蓁 在 每 個 人 心 中, 都 有 一 顆 最 寶 貝 也 最 珍 貴 的 寶 石, 願 意 用 盡 自 己 的 生 命 去 守 護 著, 不 願 意 它 受 到 任 何 傷 害, 而 我 最 想 保 護 也 最 深 愛 的 寶 石, 就 是 我 的 家 人 家 人, 是 我 的 生 命 來 源, 也 是 我 的 活 力 來 源,
More informationuntitled
不 料 料 例 : ( 料 ) 串 度 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 informationMicrosoft PowerPoint - CH07 Arrays and Vectors [相容模式]
CH7 陣列與向量 Array and Vectors 課程名稱 : 資管一程式設計任課教師 : 謝明哲單位職稱 : 台東大學資管系副教授電子郵件 :hmz@nttu.edu.tw hmz@nttu.edu.tw 2016 1 Outline 什麼是陣列? 陣列的運用 排序方式 多維陣列 hmz@nttu.edu.tw 2016 2 什麼是陣列? hmz@nttu.edu.tw 2016 3 陣列
More informationuntitled
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 information840 提示 Excel - Excel -- Excel (=) Excel ch0.xlsx H5 =D5+E5+F5+G5 (=) = - Excel 00
Excel - - Excel - -4-5 840 提示 Excel - Excel -- Excel (=) Excel ch0.xlsx H5 =D5+E5+F5+G5 (=) = - Excel 00 ( 0 ) 智慧標籤 相關說明提示 -5 -- Excel 4 5 6 7 8 + - * / % ^ = < >= & 9 0 (:) (,) ( ) Chapter - :,
More informationC/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 informationC
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