
92 學年度國立中正大學 資訊工程系 計算機概論 課程內容

Course: Introduction to Computer Science
Course(課程)Title: Introduction to Computer Science |
Instructor(教師)陳裕賢 (Yuh-Shyan Chen) 國立 中正大學資工系 副教授 |
This course introduces the basic concepts of computers and computer science. This course also introduces the basic skills of programming in the programming language C and basic techniques for solving problems using computers. This course will use Microsoft Visual C++ or Borland C++ as the programming environment.

Number: 4101009
Time: 第 13, 14 堂 (19:10-21:00), Place: EA206
| Group A:
林世敏 (資工所碩一) Office: EA301B Phone: 23123 Email: chris@wmn.cs.ccu.edu.tw Grade: Score-List |
Group B:
廖翊均 (資工所碩一) Office: EA301B Phone: 23123 Email: icl92@cs.ccu.edu.tw Grade: Score-List |
| Group C: 劉耿紹 (資工所碩二) Office: EA301B Phone: 23123 Email: lk91@cs.ccu.edu.tw Grade: Score-List |
Group D:
林云蔚 (資工所碩一) Office: EA301B Phone: 23123 Email: jyneda@giam.dynu.com Grade: Score-List |
| Group E: 安心怡 (資工所碩二) Office: EA301B Phone: 23123 Email: ahy91@cs.ccu.edu.tw
Grade:
Score-List |
Group F:
蔡家楷 (資工所碩一) Office: EA301B Phone: 23123 Email: tjk88u@cs.ccu.edu.tw Grade: Score-List |
| Group G: 張瀚謙 (資工所碩二) Office: EA301B Phone: 23123 Email: chch91@cs.ccu.edu.tw
Grade: Score-List |
Group H:
陳崇凱 (資工所碩一) Office: EA301B Phone: 23123 Email: is87013@cis.nctu.edu.tw Grade: Score-List |

C How to Program (Introducing C++ and Java)
Authors: DEITEL & DEITEL
Book Agency: 全華書局


Part I: C Language
Chapter 1:
Introduction to Computers, the Internet and the WWW PDF![]()
Chapter 2:
Introduction to C Programming PDF ![]()
Chapter 3: Structured Program Development in C
PDF![]()
Chapter 4:
C Program Control
PDF![]()
Chapter 5:
C Functions
PDF![]()
期中考週
Chapter 8:
C Characters and Strings
PDF![]()
Chapter 9:
C Formatted Input/Output
PDF![]()
Chapter 10:
C Structures, Unions, Bit Manipulations and Enumerations
PDF![]()
Chapter 11:
C File Processing
PDF![]()

計算機實習
Week 1: 請熟悉
Window 系統 and Microsoft Visual C++ 的編譯環境, 助教自行說明. 請助教確定組別 週一(A, B組), 週二(C, D組), 週三(E, F組),
週四(G, H組), 助教上課名單確定.(自行準備磁碟片備份資料), 並撰寫你(妳)的第一個 C 程式.
![]()
Week 2: 根據
程式註解格式 加註註解, 利用 scanf 指令從 keyboard
讀入 2 個整數值, 並分別計算出這兩個 2 整數值的相加, 相減, 相乘, 相除的值, 並利用 printf 印列出所計算出來的值.
![]()
Week 3:

![]()
Week 4: 請寫出一個簡易的整數計算機, 執行結果如下:
> 3 + 2
5
> 3 - 2
1
> 3 * 2
6
> 3 / 2
1
試著 (1) 先寫出 Pseudocode, (2) 畫出流程圖, (3) 寫出程式.
hint: (1) 可用 /* 代表一個 loop 一直執行 */
while (1) {
/* 填入 your program code, 執行時可以使用 Ctrl-C 來中斷執行 */
}
(2) 可用 character variable 的宣告, for example, char c; /* 以讀入 +, -, *, / */
Week 5: (不需寫 pseudocode 和 流程圖) 修改上週習題, 試著寫出一個簡易的浮點數計算機, 但是可以計算出兩個或者是三者數值, 並包含有優先順序的計算 (先乘除後加減) 例如:
> 11.2 * 2.0
22.4
> 50.0 + 11.2 * 2.0
72.4
> 50.0 + 11.2 - 2.0
63.2
> 50.0 * 11.2 / 2.0
280
Week 6: (練習 function 的寫法) 試利用亂數寫出擲出兩個骰子 (每個骰子的值介於 1 到 6), 並試著不斷的猜兩個骰子的和, 猜對的話印出猜對的訊息, 猜錯的話印出猜錯的訊息, 例如:
> 猜出兩個骰子的和: 10
> 兩個骰子: 1, 6
> 你猜錯了 !
> 猜出兩個骰子的和: 9
> 兩個骰子: 3, 6
> 你猜對了 !
> 猜出兩個骰子的和: 7
> 兩個骰子: 2, 5
> 你猜對了 !
Week 7: (練習 一維 array 和 recursive function 的用法)
利用亂數產生一維陣列的內容, 介於 1 - 1000, 注意一維陣列的大小可以任意調整, 非固定.
例如: A[0] = 77, A[1] = 123, A[2] = 671, A[3] = 8, A[4] = 345
a. 試寫一個 non-recursive function, 並利用迴圈的方法將一維陣列的內容完全反過來,
例如: 原來 A[0] = 77, A[1] = 123, A[2] = 671, A[3] = 8, A[4] = 345
結果為 A[0] = 345, A[1] = 8, A[2] = 671, A[3] = 123, A[4] = 77
b. 試寫一個 recursive function 將一維陣列的內容完全反過來,
例如: 原來 A[0] = 77, A[1] = 123, A[2] = 671, A[3] = 8, A[4] = 345
利用recursive call 的結果: A[0] = 345, A[1] = 8, A[2] = 671, A[3] = 123, A[4] = 77
Week 8: 期中考週 (週一同學本週作 Week 7 的練習)
Week 9: (期中考題)
Try to use multiple-subscripted arrays (2-D array) to write a matrix-multiplication function,
notice that your must use the call-by-reference technique.
[hint] matrix-multiplication (A, B, C); /* A, B, C are 2-D array */
Week 10:
以 pointer 寫出 bubble sorting function.
Week 11:
修改前一週的習題, 加入Pointers to Functions 的功能, 變成可 ascending 或 descending 只要在 bubble sorting function 中加入 bubble (a, SIZE, ascending) 或 bubble (a, SIZE, descending), 注意 ascending 和 descending 是兩個不同獨立的functions.
Week 12:
Write a recursive function to list all possible permutations of a given character list (string).
For example, consider an input character sequence (string) is “abcd”, then your recursive program MUST print all permutations of string “abcd”:
“abcd”, “abdc”, “acbd”, “acdb”, “adbc”, “adcb”,
“bacd”, “badc”, “bcad”, “bcda”, “bdac”, “bdca”,
“cabd”, “cadb”, “cbad”, “cbda”, “cdab”, “cdba”,
“dabc”, “dacb”, “dbac”, “dbca”, “dcab”, “dcba”.
Note that your recursive program must be produced all permutations for any-size character sequence.
Week 13:
|
Try to write
your own
_str_cpy,
_str_cat,
and _str_len
functions
as follows.
– 1.
char *_str_cpy
(char *s1, const char *s2)
/*•
Copies string s2 into s1. The value of s1 is returned.
*/
–
– 2.
char *_str_cat
(char *s1, const char *s2)
/*
•
Appends string s2 to array s1. The first character of s2 overwrites the
terminating
null character of s1. The value of s1 is returned. */
–
3. size_t
*_str_len
(
const char *s)
/* Determines the length of
string s. The number of characters preceeding the
terminating null character is returned. */
|
Week 14:
|
Try to write a recursive function to reverse a string (call by reference). |
For example, char a[] = "ABCDEFGH" ;
printf (" %s \n", a); /* "ABCDEFGH" */
reverse_string (a);
printf (" %s \n", a); /* "HGFEDCBA" */
Week 15:
Try to write a C program to read/write sequential-access files and perform a sorting procedure.
(1) Assume that you have an original data file "A. dat" with the following context.
Account Name Balance
300 White 0.00
200 Doe 345.67
100 Jones 24.98
500 Rich 224.62
400 Stone -224.62
(2) Try to read the all records from file "A.dat" and sort all the records based the on record key (Account), and write the sorted records to a new created file "B.dat", as follows.
Account Name Balance
100 Jones 24.98
200 Doe 345.67
300 White 0.00
400 Stone -224.62
500 Rich 224.62
Week 16: (10.17) Write a program that reverses the order of the bits in an unsigned integer value. The program should input the value from the user and call function reverseBits to print the bits in reverse order. Print the value in bits both before and after the bits are reversed to confirm that the bits are reversed properly.
期末考: 1/13 (週二) 下午 2:45 - 4:00.
期末範圍:
Chapter 7 - Chapter 11.
Assignment:
|
|
Program Comment Format (程式註解格式) |