Microsoft Word FinalSolution.doc

Size: px
Start display at page:

Download "Microsoft Word FinalSolution.doc"

Transcription

1 1071 NTOUCSE 程式設計 1C 期末考參考答案 1 / 7 108/01/08 ( 二 ) 1. 請根據下列要求撰寫一個 函式, 判斷傳入的 long long 型態正整數 number 是否是 2 的次方數 (1 算是 2 0 ), 是的話請傳回 1, 不是的話請傳回 0 a. [5] 請運用迴圈撰寫 while (number%2==0) number /= 2; // 把所有 2 的因數除掉, 2 k return number == 1; // 沒有其它因數時 ( 不可以是 3,5,7,9,.) 或是迴圈執行次數少一半, 稍微快一點 while (number%4==0) number /= 4; return (number!= 3); 或是只用乘法 long long int prod = 1; while (prod<number) prod *= 2; return number == prod; b. [5] 請運用函式遞迴撰寫 if (number == 1) return 1; if (number%2==0) return ispowerof2(number/2); else c. [5] 請使用運算式來完成這個函式, 不要使用迴圈 遞迴 或是 math.h 裡面的函式 ( 這些函式都運用迴圈或是遞迴, 需要使用的常數請以十六進位常數, 例如 : 0x12345abef, 或是位元運算表示 ) // number is a positive integer return 0x LL%number == 0; // 正整數 2 62 是 long long 所能表示最大的 2 的次方數 或是 // number is a positive integer return (1LL<<62)%number == 0; // 正整數 2 62 是最大的 2 的次方數 或是計算 n&(n-1)==0 // number is a positive integer return number&(number-1)==0; // or return!(number&(number-1)); 2. 考慮有理數 p/q (p<q), 其中 p 與 q 為 long long 型態可以表示的正整數 : a. [5] 如果 q<10000, 請撰寫程式在 1 秒內計算 p/q 是否可以用十進位小數精確表示, 並輸出

2 小數點右邊有幾位數? ( 例如 : 123/512= 可以精確地表示出來, 小數點右邊有 9 位數 ) Sol. 下面模擬長除法來完成判斷, 如果可以精確表示的話, 長除法的餘數會得到 0, 如果連續除以 q 3 次才整除就表示小數點右邊有 3 位數字, 如果不能夠精確表示就會有循環小數, 長除法的餘數會重複出現而永遠不會是 0, 餘數一定小於 q, 所以用 q 作為下面迴圈的上限 long long p, q; int i; scanf("%lld%lld", &p,&q); for (i=0; i<q&&p%q!=0; i++) p = (p*10)%q; if (i<q) printf(" 小數點右邊有 %d 位數字 \n", i); else printf(" 不能精確表示 \n"); b. [5] 如果 q 為 long long 型態且 q>2 50, 請撰寫程式在 1 秒內判斷 p/q 是否可以用十進位小數 精確表示, 並輸出小數點右邊有幾位數? Sol. 當 q 值很大且 p/q 不能夠精確地表示出來的時候, 題 a 裡的方法迴圈需要執行 q 次才會停下來, 如此需要很久的時間才能夠判別, 一種方法是判斷是否開始循環, 但是如下題所述判斷循環需要以記憶體紀錄哪些出現過, 實際上不需要這樣子暴力以迴圈模擬長除法來判別, 如果能夠用 10 進位 k 位小數精確表示的話, p/q 需要寫成 x/10^k 的形式, 其中 gcd(x,2)=1 且 gcd(x,5)=1, 所以只要計算 p 和 q 裡面各有幾個 2 的因數和 5 的因數就可以知道可以用幾位數字表示出來了例如 123/512 => 小數點右邊 9 位數, 123/( ) => 9 位數, ( )/( ) => 5 位數 long long p, q, q1; int count2=0, count5=0; scanf("%lld%lld", &p,&q); for (q1=q,count2=0; q1%2==0; q1/=2) count2++; while (p%2==0) p/=2, count2--; // q/p 可以被 2 count2 整除 for (count5=0; q1%5==0; q1/=5) count5++; while (p%5==0) p/=5, count5--; // q/p 可以被 5 count5 整除 if (q1==1) // q 只有 2 和 5 的因數 printf(" 小數點右邊有 %d 位數字 \n", count2>count5? count2 : count5); else printf(" 不能精確表示 \n"); c. [5] 當有理數 p/q 沒辦法用十進位小數精確表示時, 最右邊有幾位數字循環 (repeating decimal)? 例如 1/3= 最後 1 位數字循環, 452/555= 最後 3 位數字循環, 本題考慮 0<p<q 5000 Sol. 以迴圈模擬長除法時, 如果 p/q 沒有辦法用十進位小數精確表示時, 會發現餘數重複出現, 以陣列紀錄餘數是否出現過, 如果 q 很大就會需要很久的時間 2 / 7

3 int p, q, p1, period; char r[5001]=0; scanf("%d%d", &p, &q); r[0] = r[p] = 1; for (p1=p*10,period=1; period<q; r[p1]=1,p1*= 10,period++) if (r[p1=p1%q]) break; // 第 period 位數開始出現循環的餘數 p1 while (p%q!=p1) period--, p=(p*10)%q; // 第一次出現餘數 p1 的位置 printf("last %d digits repeating\n", period); 或是每一個陣列元素多用一個位元組的空間來存放第一次出現的位置 int p, q, p1, period; short r[5001]=0; scanf("%d%d", &p,&q); r[0] = r[p] = 1; for (p1=p*10,period=1; period<q; r[p1]=++period,p1*= 10) if (r[p1=p1%q]) break; // 第 period 位數開始出現循環的餘數 p1 printf("last %d digits repeating\n", p1==0?0:period-r[p1]+1); 3. 請依照各子題要求撰寫程式, 請不要使用全域變數, 不要使用 C99 可變長度陣列 (Variable length array) 語法, 以 Leibniz 公式計算 n n 矩陣 A 的行列式值 (n 10), Leibniz 公式如下 : n 1 ai, n n a i i, j 0 1 n 1 i 0 det( ) sgn( ), -by- matrix [ ], permutation... Sn Sn is the set of all permutations of 0,1,..., n-1 (e.g. 0123,0132,0213,..., if number of out of order pairs is even (e.g. =0123 or 0231) sgn( ) 1 if number of out of order pairs is odd (e.g. =3012 or 2031) a. [5] 如果整數陣列 int perm[10]; 紀錄某一個 0 到 n-1 的排列, (n 的數值不大於 10), 請撰寫一個函數 int sgn(int perm[], int n) 計算 sgn( ) 的數值 Number of out of order pairs 就是 逆序數 int sgn(int perm[], int n) int i, j, sign; for (sign=i=0; i<n; i++) for (j=i+1; j<n; j++) if (perm[i]>perm[j]) sign++; return 1-2*(sign%2); 在上課及實習時我們以下列遞迴函式列印出 n 個數字的所有排列 void permutation(int perm[], int start, int end) if (start == end) printperm(perm, end+1); return; for (int i=start; i<=end; i++) int tmp = perm[start], perm[start] = perm[i], perm[i] = tmp; permutation(perm, start+1, end); tmp = perm[start], perm[start] = perm[i], perm[i] = tmp; 3 / 7

4 其中 perm 整數陣列一開始的資料為 0,1,,n-1, b. [5] 如果輸入資料如右, 代表一個 nxn 的實數矩陣 (n 10), 第一列是 n, 接下來是 n 列資料, 每一列有 n 個實數資料, 請撰寫一個函數 int readmatrix(double ***A) 讀取並且回傳矩陣的維度 動態配置大小為 n 的 double 指標陣列以及每列恰好 n 個元素的二維 double 陣列 並且讀取矩陣 n 2 個元素到這個陣列中 #include <stdlib.h> int readmatrix(double ***A) int i, j, n; scanf("%d", &n); *A = (double **) malloc(n*sizeof(double *)); for (i=0; i<n; i++) (*A)[i] = (double *)malloc(n*sizeof(double)); for (i=0; i<n; i++) for (j=0; j<n; j++) scanf("%lf", &(*A)[i][j]); return n; c. [5] 請撰寫一個函式 double product(int perm[], double **A, int n), 傳入的參數 perm 陣列紀 n 1 錄一個 0,...,n-1 的排列, 矩陣大小 n, 以及題 b. 動態配置的矩陣 A, 計算並且回傳 ai, 的 i double 數值 double product(int perm[], double **A, int n) int i; double result = 1.0; for (i=0; i<n; i++) result *= A[i][perm[i]]; return result; d. [5] 請寫一個函式 void freematrix(int **A) 釋放動態配置的記憶體 void freematrix(double **A, int n) for (int i=0; i<n; i++) free(a[i]); free(a); e. [10] 請撰寫 main() 函式, 定義整數陣列 perm, 運用 readmatrix() 讀入矩陣資料, 初始化 perm 陣列, 修改 permutation() 函式, 運用上面的 sgn() 和 product() 函式計算矩陣的行列式值, 列印矩陣的行列式值, 最後釋放動態配置的記憶體 void calcdet(double *det, int perm[], int start, int end, double **A) int tmp; if (start == end) *det += sgn(perm, end+1) * product(perm, A, end+1); return; for (int i=start; i<=end; i++) 4 / 7 i 0

5 tmp = perm[start], perm[start] = perm[i], perm[i] = tmp; calcdet(det, perm, start+1, end, A); tmp = perm[start], perm[start] = perm[i], perm[i] = tmp; int perm[nsize], n, i; double **A, det = 0.; n = readmatrix(&a); for (i=0; i<n; i++) perm[i] = i; calcdet(&det, perm, 0, n-1, A); printf("determinant of %d-by-%d matrix is %f\n", n, n, det); freematrix(a, n); 4. 請依照下列要求撰寫一個遞迴函數, 以 Laplace 公式計算 n n 矩陣 A 的行列式值 (n 10), Laplace 公式如下 : n 1 i j det( ) ( 1) ai, jdet( i, j), i 0,..., n 1, n-by-n matrix [ ai, j] i, j 0,..., n 1, j 0 ( n-1)-b y-( n-1) matrix i, j j-th column, i.e., =[ a is the sub-matrix of A without the i-th row and the ] i, j i', j' i' 0,..., n 1 \ i, j' 0,..., n 1 \ j a. [10] 請撰寫 double detlaplace(double A[][10], int n) 函式, 參數是 double 型態的二維 10x10 陣列的矩陣資料以及 int 型態的矩陣維度 n, 回傳值是 double 型態的行列式值 請在函式內另外定義二維 10x10 的 double 陣列來存放子矩陣 i, j, 計算時請將上式 i 值指定為 0, 請撰寫迴圈, 藉由遞迴呼叫 detlaplace() 函式完成 Laplace 公式 #define NSIZE double detlaplace(double A[][NSIZE], int n) int i, j, k, k1; double sum=0, da[nsize][nsize]; if (n==1) return matrix[0][0]; for (j=0; j<n; j++) for (i=1; i<n; i++) for (k=k1=0; k<n; k++) if (k==j) continue; da[i-1][k1++] = A[i][k]; sum += (1-2*(j%2)) * A[0][j] * detlaplace(da, n-1); return sum; b. [5] 如果在 main() 函式中讀入一個 8x8 的矩陣, 請估計 detlaplace() 函式在執行時總共會被呼叫幾次? 某一個時間同時執行的 detlaplace() 函式最多有幾個? 會呼叫 1+8*7*6*5*4*3*2= 次, 同一時間最多有 8 個 detlaplace() 函數執行 5 / 7

6 c. [5] 接題 b, 因為區域變數有一個 10x10 的 double 陣列, 系統的堆疊至少需要有多少位元組程式才能順利正確完成這個遞迴函數的呼叫 ( 每一個函式呼叫, 至少需要在系統堆疊上保留區域變數以及函式參數的記憶體空間, 其它需要的記憶體空間請暫時不要考量, 另外也不要考慮 main() 函式所佔據的堆疊記憶體 )? 需要 8*(sizeof(double (*)[NSIZE])+sizeof(int)+ 4*sizeof(int)+ NSIZE * NSIZE *sizeof(double)+sizeof(double)) = 8*( )=6656 位元組 d. [5] 請用 struct 語法以及 typedef 語法定義一個結構型態 Matrix, 其中包含 10x10 的二維 double 型態陣列存放矩陣內容, 以及矩陣的維度 n struct Matrix_t double data[nsize][nsize]; int n; ; typedef struct Matrix_t Matrix; e. [5] 請撰寫函數 Matrix readmatrix() 讀取右圖矩陣的維度 n 以及 n 2 個元素, 回傳整個結構 Matrix readmatrix() int i, j; Matrix x; scanf("%d", &x.n); for (i=0; i<x.n; i++) for (j=0; j<x.n; j++) scanf("%lf", &(x.data[i][j])); return x; f. [10] 接題 d,e 請重新撰寫題 a 的 double detlaplace(const Matrix *A) 函式, 由於在 detlaplace() 函式內不會修改原來矩陣的內容, 所以 detlaplace() 函式的參數使用常數結構型態 Matrix 變數的指標, 以避免過度的資料拷貝, 函式內部子矩陣 i, j請使用動態的記憶體配置及釋放所需要的結構變數? double detlaplace(const Matrix *A) int i, j, k, k1; double sum=0; Matrix *da = (Matrix *) malloc(sizeof(matrix)); if (A->n==1) return A->data[0][0]; for (j=0; j<a->n; j++) for (i=1; i<a->n; i++) for (k=k1=0; k<a->n; k++) if (k==j) continue; da->data[i-1][k1++] = A->data[i][k]; da->n = A->n - 1; sum += (1-2*(j%2)) * A->data[0][j] * detlaplace(da); 6 / 7

7 free(da); return sum; 7 / 7

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 - CS-981.doc

Microsoft Word - CS-981.doc 4. 資料表示法 4.1 十進位與數字系統 (1). 基本觀念 數字系統的觀念 人們習慣以十進位的計量方式來計算 不同的數字系統有二進位 (Binary) 八進位 (Octal) 十進位 (Decimal) 十六進位(Hexadecimal) 二進位 電腦內部用來表達訊號的資料只有兩種符號 : 0 表示沒電,1 表示有電透過多個電路的組合表示出無數符號, 電腦便利用這些符號來表示不同的數字 利用兩條電線可以表示出

More information

Microsoft PowerPoint - 12 struct and other datatypes.ppt

Microsoft PowerPoint - 12 struct and other datatypes.ppt 第十一章結構與其它資料型態 結構與巢狀結構 結構陣列的各種使用方法 列舉型態 自定的型態別名 typedef 認識結構 使用者自定的資料型態 結構可將型態不同的資料合併成為新的型態 定義結構與宣告結構變數的格式如下 : struct 結構名稱 資料型態成員名稱 1; 資料型態成員名稱 2;... 資料型態成員名稱 n; struct 結構名稱變數 1, 變數 2,, 變數 n; 定義結構與宣告結構變數的語法

More information

Microsoft PowerPoint - C_Structure.ppt

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

chap07.key

chap07.key #include void two(); void three(); int main() printf("i'm in main.\n"); two(); return 0; void two() printf("i'm in two.\n"); three(); void three() printf("i'm in three.\n"); void, int 标识符逗号分隔,

More information

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

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

Microsoft PowerPoint - C-Ch11.ppt

Microsoft PowerPoint - C-Ch11.ppt 各式各樣的資料型態 11-1 結構的基礎知識 決定新的型態 關於結構 結構資料型態可以將不同資料型態的值整合成新的型態 結構型態的宣告語法 : struct 結構型態 { 資料型態識別字 ; 資料型態識別字 ; }; 加上 struct 進行宣告 宣告結構變數 語法 : 結構型態結構變數名稱 ; 範例 : struct Car car1; 對成員進行存取 使用結構型態的成員時, 必須使用成員選擇運算子

More information

新・解きながら学ぶC言語

新・解きながら学ぶC言語 330!... 67!=... 42 "... 215 " "... 6, 77, 222 #define... 114, 194 #include... 145 %... 21 %... 21 %%... 21 %f... 26 %ld... 162 %lf... 26 %lu... 162 %o... 180 %p... 248 %s... 223, 224 %u... 162 %x... 180

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

新版 明解C言語入門編

新版 明解C言語入門編 328, 4, 110, 189, 103, 11... 318. 274 6 ; 10 ; 5? 48 & & 228! 61!= 42 ^= 66 _ 82 /= 66 /* 3 / 19 ~ 164 OR 53 OR 164 = 66 ( ) 115 ( ) 31 ^ OR 164 [] 89, 241 [] 324 + + 4, 19, 241 + + 22 ++ 67 ++ 73 += 66

More information

C C

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

untitled

untitled 1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-1-1 C int main(void){ int x,y,z; int sum=0; double avg=0.0; scanf("%d",&x) ; scanf("%d",&y) ; scanf("%d",&z) ; sum=x+y+z ; avg=sum/3.0; printf("%f\n",avg); system("pause");

More information

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

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

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

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

<4D F736F F D DA5BFA6A1C476C1C92DBEC7ACECB8D5A8F728B57BB35D292E646F63>

<4D F736F F D DA5BFA6A1C476C1C92DBEC7ACECB8D5A8F728B57BB35D292E646F63> 全國高級中等學校 106 學年度商業類科學生技藝競賽 程式設計 職種 學科 試卷 選手證號碼 ( 崗位編號 ): 姓名 : 注意事項 : 請將答案劃記於答案卡, 未依規定劃記者不予計分 試題說明 :( 選擇題共 25 題每題 4 分, 答錯不倒扣, 共 100 分 ) ( )1. 執行以下 Visual Basic 程式片段, 其結果為何?(A) 15 (B) 12 (C) 7 (D) 3 Dim

More information

Microsoft Word - ACL chapter02-5ed.docx

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

Microsoft Word - 1-1泰宇解答

Microsoft Word - 1-1泰宇解答 學校 : 學年度第學期第次段考科目名稱命題教師 : 年 班座號 : 姓名 : 得分 : 一 單選題 : ( ). 設 (x x6) (D) x Ax Bx Cx6, 則 A B C (A)6 (B) (C) 解答 :D ( ). 求 (x x x)( x x ) 的展開式中, x 項的係數為何? (A) (B) (C)6 解答 :A (D)7 9 統測 ( ). 下列何者為多項式? (A) x (B)

More information

Microsoft Word - C-pgm-ws2010.doc

Microsoft Word - C-pgm-ws2010.doc Information and Communication Technology 資訊與通訊科技 Loops (while/for) C 廻路 姓名 : 班別 : ( ) CS C Programming #1 Functions 函數 : 1 若 n=14, 求以下表示式的值 Expressions 表示式 Value 值 Expressions 表示式 Value 值 A 20 2 * (n /

More information

第1章

第1章 第 8 章 函式 1 本章提要 8.1 前言 8.2 如何定義函式 8.3 函式的呼叫和返回 8.4 傳遞陣列 8.5 方法多載 8.6 遞迴 8.7 綜合練習 8.8 後記 2 8.1 前言 每一種高階程式語言都有提供函式 (Function)( 或稱函數 ) 的功能, 以便將經常使用到的程式功能包裝成函式的形式, 如此一來便能反覆地呼叫該函式來完成某件特定工作在高階程式語言中, 副程式 (Subroutine)

More information

######## First set of commands x <- 0.5; y <- 0 if (x>3) y <- 1 else y <- 2 ######## Second set of commands x <- 0.5; y <- 0 if (x>3) y <- 1 else ###

######## First set of commands x <- 0.5; y <- 0 if (x>3) y <- 1 else y <- 2 ######## Second set of commands x <- 0.5; y <- 0 if (x>3) y <- 1 else ### 流程控制 : if, for, while, repeat Textbook reading: Chapter 7. 條件執行 :if 指令或 if-else 指令. 當條件 A 為 TRUE 時, 執行命令 C 的語法為 if ( A ) C 當條件 A 為 TRUE 時執行命令 C, 否則執行命令 D 的語法為 if ( A ) C else D A simple example. x

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

星星排列 _for loop Protected Sub Page_Load(ByVal sender As Object, ByVal e As Dim h As Integer = 7 'h 為變數 ' Dim i, j As Integer For i = 1 To h

星星排列 _for loop Protected Sub Page_Load(ByVal sender As Object, ByVal e As Dim h As Integer = 7 'h 為變數 ' Dim i, j As Integer For i = 1 To h 資訊系統與實習 製作 : 林郁君 一 2009.09.28 9X9 'button 被按下後 ' Dim i, j As Integer For i = 1 To 9 'i 從 1 到 9' For j = 1 To 9 'j 從 1 到 9' If j * i < 10 Then ' 如果 j 乘上 i 是為個位數 ' Response.Write(i & "*" & j & " =" & i *

More information

3. 給 定 一 整 數 陣 列 a[0] a[1] a[99] 且 a[k]=3k+1, 以 value=100 呼 叫 以 下 兩 函 式, 假 設 函 式 f1 及 f2 之 while 迴 圈 主 體 分 別 執 行 n1 與 n2 次 (i.e, 計 算 if 敘 述 執 行 次 數, 不

3. 給 定 一 整 數 陣 列 a[0] a[1] a[99] 且 a[k]=3k+1, 以 value=100 呼 叫 以 下 兩 函 式, 假 設 函 式 f1 及 f2 之 while 迴 圈 主 體 分 別 執 行 n1 與 n2 次 (i.e, 計 算 if 敘 述 執 行 次 數, 不 1. 右 側 程 式 正 確 的 輸 出 應 該 如 下 : * *** ***** ******* ********* 在 不 修 改 右 側 程 式 之 第 4 行 及 第 7 行 程 式 碼 的 前 提 下, 最 少 需 修 改 幾 行 程 式 碼 以 得 到 正 確 輸 出? (A) 1 (B) 2 (C) 3 (D) 4 1 int k = 4; 2 int m = 1; 3 for (int

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

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

全國各級農會第 2 次聘任職員統一考試試題 科目 : 程式設計類別 : 九職等以下新進人員作答注意事項 : 1 全部答案請寫在答案卷內, 如寫在試題紙上, 則不予計分 2 請以黑色或藍色鋼筆或原子筆書寫, 並以橫式書寫 ( 由左至右, 由上而下 ) 一 選擇題 ( 每題 4 分, 共 40 分 )

全國各級農會第 2 次聘任職員統一考試試題 科目 : 程式設計類別 : 九職等以下新進人員作答注意事項 : 1 全部答案請寫在答案卷內, 如寫在試題紙上, 則不予計分 2 請以黑色或藍色鋼筆或原子筆書寫, 並以橫式書寫 ( 由左至右, 由上而下 ) 一 選擇題 ( 每題 4 分, 共 40 分 ) 全國各級農會第 2 次聘任職員統一考試試題 一 選擇題 ( 每題 4 分, 共 40 分 ) 1. 在 Java 語言中, 請問下列何者資料型別的變數, 所需的儲存空間最少? (a) char (b) float (c) double (d) int 2. 請問下列何者非 C 語言的關鍵字 (key word)? (a) const (b) default (c) dynamic (d) continue

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

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

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 9 [P.11] : Dev C++ [P.12] : http://c.feis.tw [P.13] [P.14] [P.15] [P.17] [P.23] Dev C++ [P.24] [P.27] [P.34] C / C++ [P.35] 10 C / C++ C C++ C C++ C++ C ( ) C++

More information

C/C++ 语言 - 循环

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

More information

C++ 程式設計

C++ 程式設計 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

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

Generated by Unregistered Batch DOC TO PDF Converter , please register! 浙江大学 C 程序设计及实验 试题卷 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:3

Generated by Unregistered Batch DOC TO PDF Converter , please register! 浙江大学 C 程序设计及实验 试题卷 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:3 浙江大学 C 程序设计及实验 试题卷 2002-2003 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:30-10:30 注意 : 答题内容必须写在答题卷上, 写在本试题卷上无效 一. 单项选择题 ( 每题 1 分, 共 10 分 ) 1. 下列运算符中, 优先级最低的是 A.

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

Microsoft PowerPoint - STU_C_Lang_CH13.ppt

Microsoft PowerPoint - STU_C_Lang_CH13.ppt 第 13 章 動態配置記憶體 程式設計與生活 - 使用 C 語言 Shi-Huang Chen Spring 2013 第 13 章 動態配置記憶體 13-1 記憶體配置函式 malloc( ) 13-2 動態配置結構陣列 配置記憶體 預估需求數量的範圍是一項不容易的學問 例 : 大到預估今年國家預算, 小到預估櫥窗裡展示的毛線衣, 需要多少磅毛線才能織成 撰寫程式時, 一樣無法預估程式執行所需的記憶體空間

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

Variable Argument Lists

Variable Argument Lists Variable Argument Lists 在 C 語言中, 當函數的 argument list 出現 ellipsis( ), 表示該函數需要使用到 variable argument lists ( 不定參數串列 ) 或稱 variable-length argument lists( 不定長度參數串列 ), 要取得 list 中的 arguments 時, 要透過 type( 型態 )

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

Microsoft Word finalSol.doc

Microsoft Word finalSol.doc 1041 國立台灣海洋大學資訊工程系 1C 程式設計期末考參考解答 姓名 : 系級 : 學號 : 1/8 105/01/06 ( 三 ) 考試時間 :13:20 16:20 請儘量回答, 總分有 122, 看清楚每一題所佔的分數再回答考試規則 :1. 不可以翻閱參考書 作業及程式 2. 不可以使用任何形式的電腦 ( 包含手機 計算機 相機以及其它可運算或是連線的電子器材 ) 3. 請勿左顧右盼 請勿交談

More information

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

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

More information

FY.DOC

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

More information

Microsoft Word - CPMidTerm2010SpringSolution

Microsoft Word - CPMidTerm2010SpringSolution 通識計算機程式設計期中考參考解答, 4/23/2010 1. (a) 宣告 double 變數 z, bool 變數 b, int 變數 i (3%) 答 : double z; bool b; (b) 在螢幕顯示一行字, 要求使用者輸入一個浮點數. (3%) 答 : Console.WriteLine(" 輸入一個浮點數 "); (c) 自鍵盤讀入一個浮點數., 並將其值存入已宣告之 double

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

Microsoft Word - 第3章.doc

Microsoft Word - 第3章.doc Java C++ Pascal C# C# if if if for while do while foreach while do while C# 3.1.1 ; 3-1 ischeck Test() While ischeck while static bool ischeck = true; public static void Test() while (ischeck) ; ischeck

More information

Microsoft PowerPoint - Lecture7II.ppt

Microsoft PowerPoint - Lecture7II.ppt Lecture 8II SUDOKU PUZZLE SUDOKU New Play Check 軟體實作與計算實驗 1 4x4 Sudoku row column 3 2 } 4 } block 1 4 軟體實作與計算實驗 2 Sudoku Puzzle Numbers in the puzzle belong {1,2,3,4} Constraints Each column must contain

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 PowerPoint - ds-1.ppt [兼容模式]

Microsoft PowerPoint - ds-1.ppt [兼容模式] http://jwc..edu.cn/jxgl/ HomePage/Default.asp 2 说 明 总 学 时 : 72( 学 时 )= 56( 课 时 )+ 16( 实 验 ) 行 课 时 间 : 第 1 ~14 周 周 学 时 : 平 均 每 周 4 学 时 上 机 安 排 待 定 考 试 时 间 : 课 程 束 第 8 11 12 章 的 内 容 为 自 学 内 容 ; 目 录 中 标 有

More information

<5B BECBB0EDB8AEC1F25D312D34B0AD5FC3E2BCAEBCF6BEF7C0DAB7E F31702E504446>

<5B BECBB0EDB8AEC1F25D312D34B0AD5FC3E2BCAEBCF6BEF7C0DAB7E F31702E504446> : 2 = 3 4? 0 an ordered set of unambiguous, executable steps that produces a result and terminates in a finite time (computational theory) ( ) 5 6 (C-) int min, max; float degree, b; char ch, token; /,,,

More information

<4D F736F F D20B3AFABD8EA4D2DB9EFBAD9A668B6B5A6A1AABA652D68ABEDB5A5A6A15FA4555F>

<4D F736F F D20B3AFABD8EA4D2DB9EFBAD9A668B6B5A6A1AABA652D68ABEDB5A5A6A15FA4555F> 對稱多項式的 h恆等式 ( 下 ): 將 h 用 的行列式表示 陳建燁 臺北市立第一女子高級中學數學教師 壹 前言 : 關於對稱多項式, 有一個很重要的事實, 稱為 對稱多項式的基本定理, 簡單地說, 即任何 元 (,,, ) 的對稱多項式, 總是可以寫成 個基本對稱多項式 ( 即,,, ) 的多項式 ( 參考資料 [4]) 例如: ( ) ( ) [ (,, )] (,, ) 那 麼, 既然 h(,,,

More information

untitled

untitled Introduction to Programming ( 數 ) Lecture 3 Spring 2005 March 4, 2005 Lecture 2 Outline 數 料 If if 狀 if 2 (Standard Output, stdout): 料. ((Standard Input, stdin): 料. 類 數 數 數 說 printf 見 數 puts 串 數 putchar

More information

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

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

ActiveX Control

ActiveX Control ActiveX Control For Visual Basic 2005.NET [ 版本 : 1.0] 1 安裝 Windows 驅動程式 請依照下列步驟 : 1. 執行 Windows 驅動程式安裝程式 ( 此範例為 PIO-DIO) 驅動程式位置 : CD:\NAPDOS\PCI\PIO-DIO\dll_ocx\Driver http://ftp.icpdas.com/pub/cd/iocard/pci/napdos/pci/pio-dio/dll_ocx/driver/

More information

迴圈控制 : for, while, repeat Textbook reading: Chapter 7. 固定次數迴圈 : for 指令. 假設有 k 個指令 C(1),..., C(k), 而我們要依序完成其中的 C(m),..., C(n), 語法為 for ( i in m:n) { C(

迴圈控制 : for, while, repeat Textbook reading: Chapter 7. 固定次數迴圈 : for 指令. 假設有 k 個指令 C(1),..., C(k), 而我們要依序完成其中的 C(m),..., C(n), 語法為 for ( i in m:n) { C( 迴圈控制 : for, while, repeat Textbook reading: Chapter 7. 固定次數迴圈 : for 指令. 假設有 k 個指令 C(1),..., C(k), 而我們要依序完成其中的 C(m),..., C(n), 語法為 for ( i in m:n) { C(i) 通常在 for 迴圈開始前, 會定義一個存結果的物件, 而在迴圈執行時更新物件. Example

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

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

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

プログラムの設計と実現II

プログラムの設計と実現II UNIX C ls mkdir man http://www.tj.chiba-u.jp/lecture/prog2/ Ctrl+x, Ctrl+s ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall

More information

<4D F736F F D B0D3B77EC3FEA7DEC3C0C476C1C9A5BFA6A1B8D5C3442DB57BA6A1B35DAD702DBEC7ACEC2E646F6378>

<4D F736F F D B0D3B77EC3FEA7DEC3C0C476C1C9A5BFA6A1B8D5C3442DB57BA6A1B35DAD702DBEC7ACEC2E646F6378> 全國國高級中中等學校 105 學年度商商業類學學生技藝藝競賽 程式式設計 職職種 學學科 試試卷 崗位位編號 : 姓名 : 注意事項 : 請將答案案劃記於答案案卡, 未依依規定劃記者者不予計分分 試題說明 :( 選擇題每每題 4 分, 共 100 分 ) ( )1. 執行以下 Visual Basic 程式片段, 其結果為何?(A) 15 Dim i As Byte i = &HFC Console.WriteLine(Not

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

Microsoft Word - Index.doc

Microsoft Word - Index.doc Programmer: B95902048 B95902085 WaveData #include ham // gfx2gba -fsrc -m -pb.pal -t8 water.bmp bg1.bmp bg2.bmp gameover.bmp water_atked.bmp #include "gfx/bg.pal.c" #include "gfx/bg.raw.c"

More information

p-2

p-2 B 卷 選擇題 共 50 題 ( 共 100 分 ) 1. 執行下列 Visual Basic 程式片段後, 共輸出幾筆資 料? x = 0: y = 1 Print y x = x + y Print x y = y + 1 If x >= 10 Then Exit Loop While y

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

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

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

Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp

Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp 01 1.6 Spyder Anaconda Spyder Python Spyder Python Spyder Spyder 1.6.1 Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Spyder Python File

More information

1

1 基本練習題 1 答 :(A) 2 答 :(B) 3 答 :(C) 4 答 :(B) 5 答 :(D) 6 答 :2 7 答 :(B) 8 答 : (A) A B C / D E * + F G / - (B) A B + C D - * E / (C) A B C * + E F + - 9 答 : (A) - + A * - / BCDE / F G (B) / * + A B C D E (C)

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

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_cpp

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

More information

untitled

untitled 料 2-1 料 料 x, y, z 料 不 不 料濾 料 不 料 料 不 料 錄 料 2-1 a 料 2-1 b 2003 a 料 b 料 2-1 料 2003 料 料 行 料濾 料亂 濾 料 料 滑 料 理 料 2001 料 兩 理 料 不 TIN, Triangular Irregular Network 8 2-2 a 數 量 料 便 精 2003 料 行 理 料 立 狀 連 料 狀 立 料

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

华恒家庭网关方案

华恒家庭网关方案 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

Microsoft Word finalSol.doc

Microsoft Word finalSol.doc 1051 NTOUCSE 程式設計 C 期末考參考答案 姓名 : 系級 : 學號 : 106/01/11( 三 ) 考試時間 :14:30 16:30 考試規則 :1. 請闔上課本, 不可參考任何文件包括小考 作業 實習 或是其他參考資料 2. 可以使用鉛筆, 可以在題目卷上直接回答, 但是請在答案卷上註明某題號的答案在題目卷上 3. 你覺得有需要的話, 可以使用沒有教過的語法, 但是僅限於 C 語言

More information

Microsoft Word - Prog1-981.docx

Microsoft Word - Prog1-981.docx 5. 變數參照 (Memory Reference) 5.1 指標 (Pointer) (1). 指標 (Pointer) 的基本觀念 特性 內含為一 Memory Address 會因不同的機器而有不同的結果 &" 也是代表變數的位址 例如 : int var1 = 2; cout

More information

1986 1 20 (1) (4) (6) (9) (17) (22) (23) (27) (33) (34) (35) (35) (96) (36) (37) (38) (39) (39) (40) (40) (41) (42) (43) (44) (44) (45) (45) (46) ( ) (50) ( ) (51) ( ) (52) (53) (55) (56) (59) (62) (67)

More information

Microsoft PowerPoint - C-Ch08.ppt

Microsoft PowerPoint - C-Ch08.ppt 函數 8-1 函數 函數 (function) 可以整合某些特定的處理 整合好的處理可以隨時呼叫使用 C 語言的程式本身也是一個函數, 也就是 main() 函數 使用函數可簡化程式 提款的處理 1. 將提款卡插入自動提款機當中 2. 輸入個人密碼 3. 指定提款金額 4. 領取款項 5. 確認款項與提款卡 提款處理 8-2 函數的定義與呼叫 定義函數的語法 : 傳回值的型態函數名稱 ( 引數列表

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

Explain each of the following terms. (12%) (a) O(n 2 ) (b) protected in C++ language (c) sparse matrix 7. Write

Explain each of the following terms. (12%) (a) O(n 2 ) (b) protected in C++ language (c) sparse matrix 7. Write Department of Computer Science and Engineering National Sun Yat-sen University Data Structures - Middle Exam, Nov. 20, 2017 1. Suppose an array is declared as a[5][6][4], where the address of a[0][0][0]

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

第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

四川省普通高等学校

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

More information

Microsoft Word - 01.DOC

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

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

(Microsoft Word - 3\271\375\246\321\257R.doc)

(Microsoft Word - 3\271\375\246\321\257R.doc) 東 野 圭 吾 短 篇 集 3 一 徹 老 爹 得 知 母 親 生 下 的 是 男 寶 寶 時, 我 打 從 心 底 感 到 開 心, 因 為 這 代 表 我 終 於 能 夠 逃 離 那 悲 慘 的 生 活 了 而 父 親 的 喜 悅 肯 定 是 遠 勝 於 我 的 母 親 在 產 房 時, 父 親 和 我 在 家 中 等 候 當 我 轉 告 他 醫 院 來 電 報 喜, 他 立 刻 如 健 美 選

More information

大 台 北 與 桃 竹 苗 地 區 北 得 拉 曼 巨 木 步 道 新 竹 縣 尖 石 鄉 鎮 西 堡 巨 木 群 步 道 新 竹 縣 尖 石 鄉 鳥 嘴 山 登 山 步 道 苗 栗 縣 泰 安 鄉 加 里 山 登 山 步 道 苗 栗 縣 南 庄 鄉

大 台 北 與 桃 竹 苗 地 區 北 得 拉 曼 巨 木 步 道 新 竹 縣 尖 石 鄉 鎮 西 堡 巨 木 群 步 道 新 竹 縣 尖 石 鄉 鳥 嘴 山 登 山 步 道 苗 栗 縣 泰 安 鄉 加 里 山 登 山 步 道 苗 栗 縣 南 庄 鄉 地 區 步 道 名 稱 蘇 花 古 道 : 大 南 澳 越 嶺 段 困 難 度 分 級 長 度 ( 公 里 ) 2 4.1 宜 蘭 縣 南 澳 鄉 南 澳 古 道 1 3.0 宜 蘭 縣 南 澳 鄉 拳 頭 姆 自 然 步 道 1 1.3 宜 蘭 縣 三 星 鄉 林 務 局 台 灣 百 條 推 薦 步 道 交 通 與 路 況 位 置 交 通 指 南 路 況 註 記 管 理 單 位 步 道 口 位 於

More information

" % % $!"#$%& (&#)$$ *&+,+-#".%&$+*- /*&0+- 1&*2%3)&#"+$%3.%&$+*- /4#&5#6 74% /*-$(&)2(+.+$( $ 811&*#24 (*!&*)-3%3 74%*&9 :%""$ & ( ;#.%$!""& )(* + ))

 % % $!#$%& (&#)$$ *&+,+-#.%&$+*- /*&0+- 1&*2%3)&#+$%3.%&$+*- /4#&5#6 74% /*-$(&)2(+.+$( $ 811&*#24 (*!&*)-3%3 74%*&9 :%$ & ( ;#.%$!& )(* + )) "! & & & & & $%& ()") *+"&%, -"*+&)&.&$, /.01"% 2 3*%0 11 ()% 3 ))04,!"") 3+0+ 2 5&%.",!"") 6"(7#( 2 8#(9&.( ((* /.01"% ((+ /.01"% 2 :&.*&(!""%!!"#!""%!""# $ #!" " % % $!"#$%& (&#)$$ *&+,+-#".%&$+*- /*&0+-

More information

Microsoft PowerPoint - C-Ch10.ppt

Microsoft PowerPoint - C-Ch10.ppt 了解陣列元素的位址 陣列 指標的應用 10-1 陣列與指標的關係 可以使用位址運算子 (&) 來查詢陣列中各個元素的位址 &test[0] 這行表示陣列最前面元素的位址 &test[1] 這行表示陣列第二個元素的位址 關於陣列名稱的機制 陣列名稱可以表示陣列最前面元素的位址 #include int main(void) int test[5] = 80,60,55,22,75;

More information

( CIP).:,3.7 ISBN TB CIP (3) ( ) ISBN O78 : 3.

( CIP).:,3.7 ISBN TB CIP (3) ( ) ISBN O78 : 3. ( CIP).:,3.7 ISBN 7 568 383 3.......... TB CIP (3) 334 3 37 ( ) 64536 www.hdlgpress.com.c 7879 6 9.75 479 3 7 3 7 45 ISBN 7 568 383 3O78 : 3. 995,.,.,.,. :,,,,.. :,,,,,,.,,,,.,,. ,,.,,,.,,,.,,,,.,.,,,

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

書本介紹

書本介紹 班 級 經 營 期 末 報 告 組 員 : 幼 三 甲 4A0I0030 蔡 依 璇 4A0I0048 蘇 家 儀 4A0I0096 張 容 嫣 4A0I0098 袁 少 潔 書 本 介 紹 閱 讀 對 象 : 小 學 低 年 級 的 老 師 新 生 家 長 有 意 從 事 小 學 者 及 關 心 教 育 品 質 的 社 會 人 士 內 容 : 1. 教 師 如 何 成 功 有 效 地 經 營 低

More information