Course: Introduction to Computer Science (二)

Course(課程)

Title: Introduction to Computer Science (二)
Number: 4101006
Time: Monday 16:15-17:30 and Thursday 16:15-17:30
Place: 工學院 A 館 001

Instructor(教師)

陳裕賢 (Yuh-Shyan Chen)
Office: EA506
Phone: 33115
Email: yschen@cs.ccu.edu.tw

Description (目標)

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.

 

Teaching Assistants (助教)

Number: 4101008

Time: 第 13, 14 堂 (19:10-21:00), Place: 工學院 A 館 001

 
週一: 林世敏 (資工所碩一)
Office: EA301B
Phone: 23123
Email: chris@wmn.cs.ccu.edu.tw

Grade: Score-List

週一: 廖翊均 (資工所碩一)
Office: EA301B
Phone: 23123
Email:  icl92@cs.ccu.edu.tw

Grade:  Score-List

週一: 郭瑞意  (資工所碩一)

Office: EA409
Phone: 23138

Email: kjy92@cs.ccu.edu.tw 

Grade:  Score-List

週二: 劉耿紹 (資工所碩二)
Office: EA301B
Phone: 23123
Email: lk91@cs.ccu.edu.tw

Grade: Score-List

週二: 林云蔚 (資工所碩一)
Office: EA301B
Phone: 23123
Email: jyneda@giam.dynu.com

Grade: Score-List

週三: 安心怡 (資工所碩二)
Office: EA301B
Phone: 23123
Email:  ahy91@cs.ccu.edu.tw

Grade: Score-List
 

週三: 蔡家楷 (資工所碩一)
Office: EA301B
Phone: 23123
Email: tjk88u@cs.ccu.edu.tw

Grade: Score-List

週四: 張瀚謙 (資工所碩二)
Office: EA301B
Phone: 23123
Email: chch91@cs.ccu.edu.tw

Grade: Score-List

週四:  陳崇凱 (資工所碩一)
Office: EA301B
Phone: 23123
Email: is87013@cis.nctu.edu.tw
Grade: Score-List
週四: 曾春森  (資工所碩一)

Office: EA409
Phone: 23138

Email: tcs92@cs.ccu.edu.tw 

Grade: Score-List

 

 

Textbook (教科書)

C How to Program (Introducing C++ and Java)

Authors:   DEITEL & DEITEL

Book Agency: 全華書局

Lecture Notes (講義)

Part I: C Language

Chapter 12: C Data Structures PDF

Chapter 13: C Preprocessor  PDF

Chapter 14: Advanced C Topics PDF

Part II: C++ Language

Chapter 15: C++ as a "Better C"  

Chapter 16: C++ Classes and Data Abstraction

Chapter 17: C++ Classes: Part II

Chapter 18: C++ Operator Overloading

Chapter 19: C++ Inheritance

Chapter 20: C++ Virtual Functions and Polymorphism

Chapter 21: C++ Stream Input/Output (study by yourself)

Chapter 22: C++ Templates

計算機實習:

 

Week 1:  (From 2/24 週二開始) Write a program to create a linked list with n nodes, where each node records a character. Then, print out all characters from the linked list.  

Week 2:  (From 3/2 週二開始) Modify the Week 1 homework, such that the linked list maintains a sorted data (characters) (類似上課的範例), and then write an insert_node function to insert a new node into the suitable place of the sorted linked list. Then, print out all characters from the linked list.  

Week 3:  (12.9) Write a program that creates a linked list of 10 characters, then create a copy of the list in reverse order. You should print out these two different linked lists.  

Week 4:  (12.20, goal: recursively print a list backwards) Write a function printListBackwards that recursively outputs the items in a list in reverse order. Use your function in a test program that creates a sorted list of integers and prints the list in reverse order.

Week 5: (Goal: parameters in main function) Write a '_copy.c' program and learn how to compile to be a executable file, _copy.com or _copy.exe.  This produces a self-defined _copy command file. You may copy a file by using your developed _copy executable file. For example, if you have a existing file, namely A.dat, then you may enter the following command in the MS-DOS mode.

                          C:> _copy   A.dat    B.dat

       Then, you may have a copied file, namely B.dat, in your disk. Note that, A.dat can be a binary file.

Week 6: Using the call-by-reference method (use &) in C++, try to write a matrix multiplication function in C++ to execute a matrix multiplication operation for two matrices A and B, where A and B are two-dimensional arrays A[ maxtrix_size ][ maxtrix_size ] and B[ maxtrix_size ][ maxtrix_size ].  You may assign the initial value of matrices A and B before the matrix multiplication operation. These results are stored into matrix C = array C[ maxtrix_size ][ maxtrix_size ], where matrix-size is the user-defined size, and finally print out all elements for matrices A, B, and C.

Week 7: Try to produce multiple source files by three separate files. First one is the declaration of all possible classes in file A.h. Second one is for the implementation of all member functions in all classes, which have been declared in A.h,  and put all implementations in file implement1.cpp. The third one is the main program and related functions, you may use file main.cpp.  Try to use the above method of multiple source files to write a simple sorting operation.

(a) You may declare sort classes in A.h

(b) All related sorting member functions (using bubble sort) are defined in implement1.cpp, and try to have a second version of sorting member functions (for instance quick sorting), where are defined in file  implement2.cpp

(c) The main program in the main.cpp.

Try to compile all of the source files, and linked all object-code files together and finally  execute it by two kinds of multiple source files:

(i)  implement1.cpp (A.h) + main.cpp (A.h),

(ii)  implement2.cpp (A.h) + main.cpp (A.h).

 Week 8: Run the program in Fig. 16.8 from the text book (including create.h, create.cpp, and fig16_08.cpp) to understand when constructors and destructors are called for global scope objects, automatic local objects, and static local objects.

              (助教可詢問學生這些細節的意義, 期末考必考題)

 

Week 9: Using this pointer to exercise the cascaded member function calls. For example, 

                 t.setHour(1).setMinute(2).setSecond(3) ; // Teaching example in fig17_08.cpp

 Try to perform the 2-dimensional matrix-multiplication operation by using the cascaded member function calls. For example,

                matrix.marix_multiplication(A).matrix_multiplication(B).matrix_multiplication(C);

Finally, you need to provide a get function to print out the result of D array, where D array is the private data in the Matrix class.

//  You must declare a Matrix class, and then to create a matrix object.

//  In Matrix class, you have a Matrix constructor member function and ~Matrix destructor

// member function. Matrix constructor should initialize a D array  to set all element be 1.

// You have three two-dimensional array (matrix)  A, B, C in main program.

// The first matrix.matrix_multiplication(A) performs D = D * A, where D is the private data.

// The second matrix.matrix_multiplication(B) performs D = D * B, where D is the private data.

// The third matrix.matrix_multiplication(c) performs D = D * C, where D is the private data.

Week 10: Create a BIRTH-DAY class, try to write your own overloading operator functions for overloading stream-insertion (<<) and stream-extraction (>>) operators.

     For example,

cin >> birth_day ;   //  you should keyin 01-02-1980

cout << birth_day ; // It outputs data with different format 1980, January 02

 

Week 11: (上課範例, Chapter 19) Try to use the public inheritance to write the overriding base-class members in a derived class.  Try to define the base class, Employee class, and derived class, HourlyWorker class. The print member function in Employee class just only print out the first and last names of an Employee object. The print function (overriding base-class members) in HourlyWorker class, including calling the based class's print function and print out the pay of an HourlyWorker object.

Week 12:  本週停乙次.

Week 13:  (本學期最後一次) Try to use the class/function template for the sorting operation. Using your designed sorting class template, you may sort data object with double and int type.  

期末考日期:  6 月 10 日 (週四)

期末考時間:  2:45 - 4:00 (pm)

期末考地點: 共同教室 301 and 302.

期末考範圍:  期中考之後的內容