Microsoft PowerPoint - CH02 Introduction to C++ Programming_輸入與輸出 [相容模式]

Size: px
Start display at page:

Download "Microsoft PowerPoint - CH02 Introduction to C++ Programming_輸入與輸出 [相容模式]"

Transcription

1 Ch2. Introduction to C++ Programming 輸入與輸出 標準 I/O 課程名稱 : 程式設計 Computer Programming 班級 : 資管一 Freshman, ISMS 任課教師 : 謝明哲 Hsieh, Ming-Che, Miller 單位職稱 : 台東大學資管系副教授 Associate Professor, ISMS, NTTU 電子郵件 :hmz@nttu.edu.tw hmz@nttu.edu.tw hmz@nttu.edu.tw 標準 I/O 檔案 I/O 習題 樂活時間 Outline iostream #include <iostream> using namespace std; // 輸入 :cin>> 變數 ; cin>>x>>y; // 輸出 :cout<< 變數或常數 ; cout<<x<< + <<y<< = <<(x+y)<<endl; hmz@nttu.edu.tw hmz@nttu.edu.tw

2 cin 的成員函式 cin.width( 欄位寬度 ) cin.width(5); cin.getline( 變數, 長度, '\n') char sentence[81]; cin.getline(sentence, 81, n ); 格式化 I/O #include <iomanip> 設定輸入輸出長度 setw() char string[4]; cin >> setw(4) >> string; int number = 25; cout << '(' << number << ")\n"; cout << '(' << setw(3) << number << ")\n"; hmz@nttu.edu.tw hmz@nttu.edu.tw cin.get( 字元變數 ) char key; cin.get(key); // 取得鍵盤按鍵 cin.ignore( 長度 ) cin >> num; cin.ignore(); // 忽略前一輸入字元 Enter cin.get(key); 設定有效位數 setprecision const double PI = ; cout << setprecision(5) << PI << endl; cout << setprecision(8) << PI << endl; hmz@nttu.edu.tw hmz@nttu.edu.tw

3 設定輸出旗號 setiosflags setiosflags(ios:: 格式旗號 ); float number = 35.7 cout << setprecision(4) << number; cout << setiosflags(ios::fixed) << setprecision(2) << number; cout << setiosflags(ios::fixed ios::showpoint) << setprecision(2) << number; cout 的成員函式 cout.width( 欄位寬度 ) cout.width(5); // 相當於 cout << setw(5); cout.precision( 有效位數 ) cout.precision(2); // 相當於 cout<<setprecision(2); hmz@nttu.edu.tw hmz@nttu.edu.tw 輸出格式旗號 格式旗號 說明 ios::boolalpha 布林值以 true false 顯示 ios::left 向左對齊到輸出欄位的最左邊 ios::right 向右對齊到輸出欄位的最右邊 ios::fixed 正常顯示, 非科學記號顯示 ios::scientific 以科學記號顯示輸出的數值, 例 1.38e+23 ios::dec 以 10 進位格式顯示整數 ios::hex 以 16 進位格式顯示整數 ios::oct 以 8 進位格式顯示整數 ios::showpoint 根據有效位數, 強迫顯示小數點後的 0 ios:showbase 顯示基底 ios::showpos 在正數的前面顯示 + 號 ios::skipws 忽略空白字元 ios::uppercase 以大寫顯示科學記號中的 E 和十六進位的 X cout 的成員函式 cout.setf(ios:: 格式旗號 ) cout.setf(ios::fixed); // 相當於 cout << setiosflags(ios::fixed); cout.unsetf(ios:: 格式旗號 ) cout.unsetf(ios::fixed);// 關閉固定小數 cout.unsetf(ios::left); // 關閉向左對齊格式 hmz@nttu.edu.tw hmz@nttu.edu.tw

4 標準 I/O 與運算式的應用實例 計算成績平均 // 課堂練習範例 1.1 average.cpp #include <cstdlib> #include <iostream> using namespace std; int main() { printf() #include <stdio.h> printf( 格式字串, 變數或常數, ); 格式字串 %[width][modifiers]type 例示 printf( Total: %d, total_number); printf( Average: %5.3f, average); hmz@nttu.edu.tw hmz@nttu.edu.tw } int grade[5]; cin>>grade[0]>>grade[1]>>grade[2] >>grade[3]>>grade[4]; double average; average = (grade[0]+grade[1]+grade[2]+grade[3]+grade[4])/5.0; cout.precision(1); cout<<" 平均成績 = <<fixed<<average+0.05<<endl; system("pause"); return 0; 列印格式 type %c 字元輸出 %d 以 10 進位格式顯示整數 %u 無號整數輸出 %o 以 8 進位格式顯示整數 %x, %X 以 16 進位格式顯示整數, 以 0 ~ f 或 0~F 表示 %f 浮點數輸出, 小數點型式 %e, %E 以科學記號顯示,10 的次方以 e 或 E 表示 %g, %G 浮點數輸出, 印出 %f 與 %e ( 或 %E) 較短者 %s 字串輸出 %p 指標位址輸出 %% 顯示百分比符號 hmz@nttu.edu.tw hmz@nttu.edu.tw

5 修飾子 modifier + 顯示正負號 %+3d - 向左對齊 %-5d 0 固定長度數值前補 0; 與 同時使用時無效 %09.3f 空白 正值留一空白字元 ; 負值則顯示負號 % 8f 數字 欄位長度 ; 數值位數大於指定欄位長度時自動加寬 %6d. 以 %e, %E, %f 格式列印時, 決定小數點後顯示位數 %3.2f h 以 short int 輸出 %h l 以 long int 輸出 %lu 檔案 I/O hmz@nttu.edu.tw hmz@nttu.edu.tw scanf() #include <stdio.h> int scanf( 格式字串, 變數位址, ); 格式字串 %[*][width][modifiers]type * 表示略過的參數 例示 int a, b; scanf( %d %d, &a, &b); char str[80]; scanf( %s, str); 開啟新檔覆蓋寫入 // 開啟覆蓋寫入檔案物件 ofstream fout( filename, ios::out); // 寫入 :fout<< 變數或常數 ; if (!fout) cout<< file open error ; else fout<<x<<y<<endl; hmz@nttu.edu.tw hmz@nttu.edu.tw

6 開啟舊檔附加寫入 // 開啟附加寫入檔案物件 ofstream fout( filename, ios_base::app); 關閉檔案 fout << flush; // 回寫緩衝區 fout.close(); // 檔案關閉 // 寫入 :fout<< 變數或常數 ; if (!fout) cout<< file open error ; else fout<<x<<y<<endl; hmz@nttu.edu.tw hmz@nttu.edu.tw 開啟舊檔讀取資料 // 開啟讀取檔案物件 ifstream fin( filename, ios::in); // 讀取 :fin>> 變數 ; if (!fin) cout<< file open error ; else fin>>x>>y; 檔案 I/O 的應用實例 計算成績平均 // 課堂練習範例 1.1 average.cpp //#include <cstdlib> #include <iostream> using namespace std; int main() { int grade[5]; cin>>grade[0]>>grade[1]>>grade[2] >>grade[3]>>grade[4]; hmz@nttu.edu.tw hmz@nttu.edu.tw

7 } ofstream outfile("grade.dat", ios::out); outfile<<grade[0]<<grade[1]<<grade[2] <<grade[3]<<grade[4]; ifstream infile("grade.dat", ios::in); infile>>grade[0]>>grade[1]>>grade[2] >>grade[3]>>grade[4]; cout<<grade[0]<<" "<<grade[1]<<" "<<grade[2] <<" "<<grade[3]<<" "<<grade[4]<<endl; double average; average = (grade[0]+grade[1]+grade[2]+grade[3]+grade[4])/5.0; cout<<" 平均成績 = "<<average<<endl; system("pause"); return 0; hmz@nttu.edu.tw Ch2. Exercises 2.12 (9%) 2.14 (9%) 2.15 (9%) 2.16 (10%) 2.19 (10%) 2.20 (10%) 2.22 (10%) 2.23 (10%) 2.24 (10%) 2.27 (10%) 2.28 (10%) hmz@nttu.edu.tw 樂活時間 習題 哈佛飲食金字塔 2002 年, 美國哈佛大學公共衛生學院 Willett 博士等專家, 修正 1992 年美國農業部的飲食指南金字塔, 建立一套更符合現代人需求的健康飲食指南, 期望降低心血管及癌症等慢性病的發生 這個金字塔為健康永續生活實踐者加分 hmz@nttu.edu.tw hmz@nttu.edu.tw

8

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

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

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

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

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

More information

C/C++程序设计 - 字符串与格式化输入/输出

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

More information

02

02 Thinking in C++: Volume One: Introduction to Standard C++, Second Edition & Volume Two: Practical Programming C++ C C++ C++ 3 3 C C class C++ C++ C++ C++ string vector 2.1 interpreter compiler 2.1.1 BASIC

More information

新版 明解C++入門編

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

IO

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

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

Strings

Strings Streams and File I/O Cheng-Chin Chiang Streams 串流是 C++ 中一種負責資料輸出入程式的機制 輸入串流 : 資料流入程式 鍵盤 程式 檔案 程式 輸出串流 : 資料流出程式 程式 螢幕 程式 檔案 String Usage 我們已經學過的串流 cn: 鍵盤輸入串流 cout:: 螢幕輸出串流 我們可以定義其他形式的串流 例如 : 檔案輸入或檔案輸出 使用方法與

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

105A 資管一程式設計實驗 06 函式定義謝明哲老師 2 程式設計實驗 6.3: 自行定義一個可以接受兩個整數並傳回其最大公因數的函式, 接著利用該函式自 行定義一個可以接受兩個整數並傳回其最小公倍數函式 // gcd_fcn.cpp int gcd(int m,

105A 資管一程式設計實驗 06 函式定義謝明哲老師 2 程式設計實驗 6.3: 自行定義一個可以接受兩個整數並傳回其最大公因數的函式, 接著利用該函式自 行定義一個可以接受兩個整數並傳回其最小公倍數函式 // gcd_fcn.cpp int gcd(int m, 105A 資管一程式設計實驗 06 函式定義謝明哲老師 hmz@nttu.edu.tw 1 程式設計實驗 06 函式定義 模擬問題 03 在模擬問題 02, 小組已完成擬定一個與學習或日常生活有關的問題, 並依據在 Ch5 所 學到的流程控制與檔案存取技術發展小組的第二版個別化資訊服務程式 現在請小組對第二版程式的 結構進行分析, 檢查是否有哪些功能可以使用在 Ch6 所學到的函式定義來加以模組化,

More information

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

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

More information

C 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

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

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

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

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

C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 告别 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 1 TEMPLATE 1 Template 描述 使用模板函数求最大值 使用如下 main 函数对程序进行测试 int main() { double a, b; cin >> a >> b; cout c >> d; cout

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 PowerPoint - Class4.pptx

Microsoft PowerPoint - Class4.pptx C++ 程式初探 IV 2015 暑期 ver. 1.0.2 C++ 程式 IV 大綱 1. 時間函式 2. 格式化輸出 3. 遞迴函式 (recursion) 4. 字串 5. 字串轉型 2 補充語法 時間計算 引入標頭檔 #include #include #include #include using namespace

More information

Microsoft PowerPoint - chap3

Microsoft PowerPoint - chap3 第三章基本輸出與輸入的方法 資訊科技系 林偉川 本章簡介 如何從鍵盤輸入資料以及從螢幕輸出結果, 是寫程式一個很基本的技巧, 因為這也是使用者與電腦交談的重要橋樑 在 C 語言函式庫中有不少輸出 / 入相關函式, 不過較常用到的也只有其中幾個 從螢幕輸出類 : 由鍵盤輸入類 : 2 1 從螢幕輸出類 printf(): 函數名稱取 print 以及 format 兩個字組成 此函式會將我們指定的字串以指定的格式輸出在螢幕上

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

第八﹑九章 I/O系統

第八﹑九章 I/O系統 第八 九章 I/O 系統 檔案 I/O 的基本概念 格式化 I/O 建立自訂的嵌入子 建立自訂的擷取子 自訂 I/O 與檔案 檔案 I/O 的基本概念 C++ 對 I/O 的支援是放在 中, 而 Class ios 包括有許多成員函數與變數可以用來控制和監督串流的運作. 要處理檔案 I/O, 心必須 #include, 它包含了 ifstream,ofstream

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

第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

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

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++ - 字符输入输出和字符确认 C/C++ Table of contents 1. 2. getchar() putchar() 3. (Buffer) 4. 5. 6. 7. 8. 1 2 3 1 // pseudo code 2 read a character 3 while there is more input 4 increment character count 5 if a line has been read,

More information

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

新・明解C言語入門編『索引』 !... 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

Microsoft PowerPoint - 02_運算.pptx

Microsoft PowerPoint - 02_運算.pptx 回顧 第一個程式 基本架構 五行必寫的公式 註解的寫法 cout

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

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++语言 - 运算符、表达式和语句

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

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

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++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 OJ2 - 参考答案 MASTER 2019 年 5 月 3 日 1 1 PERSON 1 Person 题目描述 编写程序, 定义一个基类 Person, 包含 name 和 age 两个数据成员 ; 再由它派生出学生类 Student 和教师类 Teacher, 其中学生类添加学号 no 数据, 教师类添加职称 title 数据 ; 要求每个类均有构造函数 析构函数和显示数据的函数

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

Learning by debugging

Learning by debugging Learning C by debugging 序言 這本書是我規劃 C 語言學習地圖的第三本 看完第一本的 樂在 C 語言 後, 希望您能在 戰勝 C 語言, 這也是本書取名的考量因素 同時在內容的深度與廣度上也加以擴大, 俾能對 C 有更進一步的了解 第三本是 精通 C/C++ 指標 期使您對 C 語言的核心主題 指標, 能更上一層樓 有人常問我學好程式設計的秘方是什麼, 其實沒有秘方, 只要在碰到有錯誤時

More information

《计算概论》课程 第十九讲 C 程序设计语言应用

《计算概论》课程 第十九讲  C 程序设计语言应用 计算概论 A 程序设计部分 字符数组与字符串 李戈 北京大学信息科学技术学院软件研究所 lige@sei.pku.edu.cn 字符数组的定义 #include int main() char a[10] = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ; for (int i = 0; i < 10; i++) cout

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

untitled

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

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

運算子多載 Operator Overloading

運算子多載 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 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

FY.DOC

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

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

C 語言—陣列及字串

C 語言—陣列及字串 10/16 系程主講人 : 荊輔翔 概論 陣列 陣列是一個具有索引 (index) 性質的連續資料儲存空間集合 陣列中每一個資料儲存空間稱之為陣列元素 (array element); 它們都具有相同的資料名稱 資料型態 及空間大小 ; 但存取它們時則須藉由索引 ( 或稱註標 ) 來區別辨識 索引代表資料在陣列中的相對位址 ( 其計數由 0 開始, 其餘累加類推 ), 且須由中括號 [ ] 涵蓋之

More information

C++ 程序设计 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1

C++ 程序设计 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1 C++ 程序设计 OJ1 - 参考答案 MASTER 2019 年 5 月 3 日 1 1 CIRCLE 1 Circle 描述 编写一个圆类 Circle, 实现半径的输入 面积的计算和输出 输入 圆的半径 (double 类型 ) 输出 圆的面积 ( 保留小数点后两位 ) 样例输入 3 样例输出 28.27 提示 圆周率的取值需要比较精确, 以保证计算结果的精度 #include

More information

untitled

untitled 1 1.1 1.2 1.3 1.4 1.5 ++ 1.6 ++ 2 BNF 3 4 5 6 7 8 1.2 9 1.2 IF ELSE 10 1.2 11 1.2 12 1.3 Ada, Modula-2 Simula Smalltalk-80 C++, Objected Pascal(Delphi), Java, C#, VB.NET C++: C OOPL Java: C++ OOPL C# C++

More information

( 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

運算子多載 Operator Overloading

運算子多載 Operator Overloading 多型 Polymorphism 講師 : 洪安 1 多型 編譯時期多型 ( 靜態多型 ) function overloading 如何正確呼叫同名的函數? 利用參數個數與型態 operator overloading 其實同 function overloading 執行時期多型 ( 或動態多型 ) 如何正確呼叫不同物件的相同名稱的成員函數 利用繼承與多型 2 子類別與父類別物件間的指定 (assignment)

More information

C Formatted Input/Output

C Formatted Input/Output 表示結果是解決任何問題中很重要的一部分 本章將會深入介紹 scanf 和 printf 的格式化功能 這兩個函式分別可以用來從標準輸入資料流 (standard input stream) 輸入資料, 以及從標準輸出資料流 (standard output stream) 輸出資料 第 8 章曾討論過其他四個使用標準輸入和標準輸出的函式 -gets puts getchar 和 putchar 呼叫上述的函式時,

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

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

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

More information

Microsoft PowerPoint - ch09_AEL0080.ppt

Microsoft PowerPoint - ch09_AEL0080.ppt 9 字 串 子曰 : 質勝文則野, 文勝質則史 文質彬彬, 然後君子 論語論語.雍也第六雍也第六 標準的 C++ 提供了方便的程式庫, 讓我們能將 字串 視為獨立的單元, 以進行各種存取和剪接的處理 1/36 字串 9.1 9.2 9.3 9.4 9.5 字串的基本概念字串的輸入與輸出字串的處理字串的指標陣列字串處理在編碼上的應用 2/36 字串的基本概念 字串 (string) 是由雙引號 所包括起來的一串文字

More information

840 提示 Excel - Excel -- Excel (=) Excel ch0.xlsx H5 =D5+E5+F5+G5 (=) = - Excel 00

840 提示 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 information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 177 [P179] (1) - [P181] [P182] (2) - for [P183] (3) - switch [P184] [P187] [P189] [P194] 178 [ ]; : : int var; : int var[3]; var 2293620 var[0] var[1] 2293620

More information

Microsoft PowerPoint - 20-string-s.pptx

Microsoft PowerPoint - 20-string-s.pptx String 1 String/ 1.: char s1[10]; char *s2; char s3[] = "Chan Tai Man"; char s4[20] = "Chan Siu Ming"; char s5[]={'h','e','l','l','o','\0'; 0 1 2 3 4 5 6 7 8 9 10 11 12 s3 C h a n T a i \0 M a n \0 printf

More information

Microsoft Word - AEL 序.doc

Microsoft Word - AEL 序.doc 序 C++ 全方位學習一書入選 100 狀元閱讀書單科學類排名第 15, 也是唯二入選的程式設計類書, 因此筆者決定重新改版, 以便造福更多想學習 C++ 程式設計的學生 C++ 全方位學習第二版保留第一版的編排特色, 而刪除比較不實用的大型程式範例與標準範本程式庫, 然後在各章習題中加入選擇題, 使其更加適合用於技職院校及大學教學 C++ 全方位學習第二版是針對專科與大學教學進度而編寫的, 內容由淺入深

More information

Microsoft PowerPoint - Class2.pptx

Microsoft 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

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

Strings

Strings Strings Cheng-Chin Chiang Strings Strings 一串儲存在連續記憶體之字元串 表示法 : 以雙引號圍起 This is a book, I love programming, 12234 字串須有一結束字元 \0 (NULL) 在字串尾,NULL 在 C++ 內為一個內定常數值 H i t h e r e! \0 An Array Type of Strings

More information

2015年计算机二级(C语言)模拟试题及答案(四)

2015年计算机二级(C语言)模拟试题及答案(四) 2016 年 计 算 机 二 级 (C 语 言 ) 模 拟 试 题 及 答 案 (4) 一 填 空 题 1 C 语 言 中 基 本 的 数 据 类 型 有 : 2 C 语 言 中 普 通 整 型 变 量 的 类 型 说 明 符 为, 在 内 存 中 占 字 节, 有 符 号 普 通 整 型 的 数 据 范 围 是 3 整 数 -35 在 机 内 的 补 码 表 示 为 4 执 行 下 列 语 句 int

More information

C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1

C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1 C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1 1 CARDGAME 1 CardGame 题目描述 桌上有一叠牌, 从第一张牌 ( 即位于顶面的牌 ) 开始从上往下依次编号为 1~n 当至少还剩两张牌时进行以下操作 : 把第一张牌扔掉, 然后把新的第一张放到整叠牌的最后 请模拟这个过程, 依次输出每次扔掉的牌以及最后剩下的牌的编号 输入 输入正整数 n(n

More information

Microsoft Word - Chap02.doc

Microsoft Word - Chap02.doc 標準的輸入與輸出 2-1 字元的輸出與輸入 2-2 格式化的輸出與輸入 2-3 摘要 2-4 關鍵字 2-5 問題演練 2-6 程式實作 i 上 C 語言 這一章我們將談論標準的輸入與輸出 (standard input/output) 所謂標準的輸入與輸出, 其作用端分別為鍵盤和螢幕 除了標準的輸入與輸出外,C 語言還提供檔案的輸入與輸出, 其作用端皆為檔案, 此部份留在第十一章 : 檔案, 再加以解說

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

Microsoft PowerPoint - 12_StreamIO.ppt

Microsoft PowerPoint - 12_StreamIO.ppt 1 第 12 章 C++ Stream Input/Output 12.1 簡介 12.2 串流 (Streams) 12.3 輸出串流 (Stream output) 12.4 輸入串流 (Stream output) 12.5 未格式化 I/O 12.6 串流操作器 12.7 串流格式設定 12.8 串流錯誤狀態處理 12.9 結合輸入 / 輸出串流 2 一般 I/O 特色 C++ I/O 物件導向

More information

Microsoft Word - well_game.doc

Microsoft Word - well_game.doc 智慧型系統控制 趙春棠老師 四技機電四甲 49422019 黃秉宏 井字遊戲並沒有什麼必勝的著法, 但只要適當的回應, 就可保持不敗 也 1 2 3 4 5 6 7 8 9 法則 手玩家的最佳著法其第一步最好下在四個角落 ( 即 2 4 6 8 號位置 ), 因為後手玩家除了下在中央的 5 號位置之外必敗 即使對手下了該位置, 只要回以馬步佈局或對角佈局也還有一半的勝算 先手玩家第一步的次佳選擇在

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

Microsoft PowerPoint - Class5.pptx

Microsoft PowerPoint - Class5.pptx C++ 程式初探 V 2015 暑期 ver. 1.0.1 C++ 程式語言 大綱 1. 大量檔案讀取 & 計算 2. 指標 3. 動態記憶體 & 動態陣列 4. 標準函式庫 (STL) vector, algorithm 5. 結構與類別 2 大量檔案讀取 & 計算 若目前有一個程式將讀取純文字文件 (.txt) 中的整數, 並將該文件中的整數有小到大排序後, 儲存到另外一個新的純文字件中 假設有

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

5-1淡江大學學則950602

5-1淡江大學學則950602 淡 江 大 學 學 則 教 育 部 台 (86) 高 ( 二 ) 字 第 86028132 號 函 核 准 87.10.28 教 務 會 議 通 過 87.11.06 校 務 會 議 通 過 教 育 部 台 (87) 高 ( 二 ) 字 第 87145848 號 函 備 查 88.01.26 (88) 校 秘 字 第 0243 號 函 修 正 89.06.09 第 43 次 校 務 會 議 修 正

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

<4D6963726F736F667420576F7264202D20313034B0EABB79A4E5B8D5C344BBBCB065AAA9>

<4D6963726F736F667420576F7264202D20313034B0EABB79A4E5B8D5C344BBBCB065AAA9> 嘉 義 縣 104 年 新 港 溪 北 六 興 宮 正 黑 麵 三 媽 盃 小 六 學 藝 競 試 國 文 試 卷 一 一 般 選 擇 題 : 1. 下 列 選 項 中, 哪 一 組 字 的 讀 音 是 相 同 的?(A) 躡 足 / 攝 影 (B) 淒 慘 / 妻 兒 (C) 漠 不 關 心 / 眼 角 膜 (D) 韋 編 / 偉 人 2. 下 列 內 的 部 首, 何 者 正 確?(A) 黎 明

More information

凡 例 一 高 淳 县 历 史 悠 久, 文 物 古 迹 颇 丰, 为 全 面 系 统 地 保 存 各 类 文 物 资 料, 介 绍 文 物 工 作 情 况, 达 到 教 育 后 人, 提 供 专 业 研 究 的 目 的, 特 编 纂 本 志 二 本 志 采 用 记 志 述 图 表 等 多 种 体 裁, 翔 实 记 载 高 淳 县 自 旧 石 器 时 代 至 民 国 年 间 的 文 化 遗 存 文

More information

康體藝術

康體藝術 320 321 0.12% (340 ) 3.44% (1.001 ) 0.30% (860 ) 5.93% (7.542 ) 7.83% (2.277 ) ( 7,960 1,810 ) 3.36% (9,770 ) 9.08% (2.642 ) 20.27% (5.898 ) ( ) 29.67% (8.63 ) 322 π 323 324 325 326 327 328 329 330 331

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

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

踏出C++的第一步

踏出C++的第一步 踏出 C++ 的第一步 講師 : 洪安 1 已經學會的 C 語言基本概念 基本資料型態 變數 基本輸入輸出 控制敘述 選擇控制 迴圈 陣列 函式 指標 字元與字串 結構 檔案處理 2 C v.s. C++ C 函數 程序式語言 Procedural language 結構化程式設計 Structured programming 演算法 Top-down C++ 類別 物件導向程式設計 Object-Oriented

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

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

Microsoft PowerPoint - CPP-Ch Print.ppt [兼容模式]

Microsoft PowerPoint - CPP-Ch Print.ppt [兼容模式] Chapter 17 File Processing http://jssec.seu.edu.cn 杨明 yangming2002@seu.edu.cn OBJECTIVES To create, read, write and update files. Sequential file processing. Random-access file processing. To use high-performance

More information

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

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

More information

Microsoft Word - ACG chapter00c-3ed.docx

Microsoft Word - ACG chapter00c-3ed.docx Python 好好玩, 趣學電玩遊戲程式設計 Python Python BASIC Java JavaScript PHP C++ BASIC Python Python Python Xbox PlayStation Nintendo - 2 - 簡介 : 互動式 Python Shell : 編寫程式 Python File editor : 猜數字 : 腦筋急轉彎 : 龍域 ( ) : 使用

More information

C/C++基礎程式設計班

C/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 - 01.DOC

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

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

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++: 物件的使用 參考 重載函式 成就別人認為不可能的事 Do what nobody else considered possible. -Steve Jobs 講師 : 張傑帆 CSIE NTU C++ 相較於 C 的特色 向下相容 在 C 語言中, 我們學了許多程式語法, 所有學過的東西, 在 C++ 中都可以使用 高階的程式描述方式 更利於用來開發大型專案, 讓程式設計師在分工時更能快速的開發程式,

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

運算子多載 Operator Overloading

運算子多載 Operator Overloading 多載 Overloading 講師 : 洪安 1 多型 編譯時期多型 ( 靜態多型 ) function overloading 函數多載 如何正確呼叫同名的函數? 利用參數個數與型態 operator overloading 運算子多載 其實同 function overloading 執行時期多型 ( 或動態多型 ) 如何正確呼叫不同物件的相同名稱的成員函數 利用繼承與多型 2 函數多載 Function

More information