94 學年度第二學期 國立中正大學 資訊工程系 計算機概論 課程內容
Course: Introduction to Computer Science
Course(課程)科目名稱: 計算機概論(二) |
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).
Group A: 魏藩東 (資工所碩一)
Office: EA308 |
Group B:
邱冠霖
(資工所博一) |
Group C: 呂振瑋 (資工所碩一) Office: EA301B |
|||
Group D:
莊明晉
(資工所博一) |
Group E:
陳柏達
(資工所碩一) |
||||
Group F:
謝博在
(資工所碩二) |
Group G:
蕭煒翰
(資工所碩二) |
Group H:
廖運偉
(資工所碩一) |
|||
Group I:
詹欣智
(資工所碩二) |
Group J:
吳昆霖
(資工所碩一) |
|
C How to Program (Introducing C++ and Java)
Authors: DEITEL & DEITEL
Book Agency: 全華書局
Chapter 11: File Processing E
Chapter 12: Data Structure
Chapter 14: Advanced C Topics
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 22: C++ Templates
Chapter 11: C File Processing PDF
計算機實習
科目名稱: 計算機概論實習(二)
科目代碼: 4101008
授課教師: 陳裕賢
上課時間: 三13,14
上課教室: 工學院A館509
Program Comment Format (程式註解格式)
Week 1: 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 2
: Try to create a random-access file "C.dat" to store same records in Week 1, you may use the Account as the record key, and then print out all records from the random-access file "C.dat" based on the record key Account.Week 3: (週二開始) Write a program to create a linked list with n nodes such that the linked list maintains a sorted data (characters) by the ascending order, where each node records a character. First, you print out all characters from the original linked list. Then, write an insert_node function to insert a new node into the suitable place of the sorted linked list. Finally, print out all characters from the modified linked list after inserting a new node into the original linked list.
Week 4: (週二開始) Follow your program in Week 3, further write a delete_node function to delete a node from the linked list. Finally, print out all characters from the modified linked list after deleting a node.
Week 5: (週二開始) Modify your program in weeks 3 and 4 to write enqueue (insert) and dequeue (delete) functions by linked list to implement the queue data structure.
Week 6: (週二開始) Write a program to create a binary search tree, where the input data sequence is 27, 13, 17, 42, 56, 23, 72, 33, 48, and 6. Then, print out the results by the preorder, inorder, and postorder tree traversal.
期中考:
Week 7: (週二開始) (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 8: (週二開始) 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 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: (週二開始)
Try to use the C++ Operator Overloading, write the '+' operator function.
HugeInteger bigInteger(999999999999999999);
bigInteger = integer + bigInteger;
cout << " The sum is " << bigInteger ;
Week 11: (週二開始) 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: (Exercise 20.14, 週二開始, 週三的同學下週三一起 demo) In Exercise 19.12, you developed a Shape class hierarchy and defined the classes in the hierarchy. Modify the hierarchy so that class Shape is an abstract base class containing the interface to the hierarchy. Derive TwoDimensionalShape and ThreeDimensionalShape from class Shape -- these classes should also be abstract. Use a virtual print function to ouptut the type and dimensions of each class. Also include virtual area and volume functions so these calculations can be performed for objects of each concrete class in hierarchy. Write a driver program that tests the Shape class hierarchy.
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/27 中午 12:00 之前找我 check, 過了時限, 不再修正,
要求加分者不需要來找我 (尤其是加完分數之後不及格, 尤其是 58, 59 分的同學),
因為我已經統一加總分了 5 分, (參加程式比賽的同學再另外加 2 分).
新修正成績 (09:42 am, 6/27)
系所 | 學號 | 姓名 | 期中考 | 期末考 | 實習 | 總分 | 平均 | 調分後 | |
哲學系 | 491125046 | 36 | 45 | 92 | 173 | 61 | 66 | ||
資工系 | 491410087 | 56 | 45 | 69 | 170 | 58 | 63 | ||
資工系 | 492410050 | 90 | 64 | 58 | 212 | 69 | 74 | ||
資工系 | 492410096 | 0 | 0 | 0 | 0 | 0 | 5 | ||
資工系 | 492410103 | 35 | 50 | 0(未修習) | 85 | 43 | 48 | ||
資工系 | 492410108 | 80 | 72 | 80 | 232 | 78 | 83 | ||
資管系 | 492530002 | 85 | 88 | 89 | 262 | 88 | 93 | ||
資工系 | 493210026 | 97 | 85 | 91 | 273 | 91 | 96 | ||
資工系 | 493410001 | 62 | 60 | 81 | 203 | 69 | 74 | ||
資工系 | 493410011 | 70 | 70 | 87 | 227 | 77 | 82 | ||
資工系 | 493410017 | 75 | 58 | 86 | 219 | 74 | 79 | ||
資工系 | 493410020 | 0 | 0 | 0 | 0 | 0 | 5 | ||
資工系 | 493410023 | 57 | 65 | 59 | 181 | 60 | 65 | ||
資工系 | 493410024 | 83 | 53 | 79 | 215 | 72 | 77 | ||
資工系 | 493410030 | 45 | 50 | 91 | 186 | 65 | 70 | ||
資工系 | 493410039 | 90 | 78 | 84 | 252 | 84 | 89 | ||
資工系 | 493410043 | 0 | 0 | 0 | 0 | 0 | 棄選 | 0 | |
資工系 | 493410054 | 25 | 0 | 0 | 25 | 8 | 13 | ||
資工系 | 493410057 | 98 | 58 | 73 | 229 | 76 | 81 | ||
資工系 | 493410066 | 0 | 0 | 0 | 0 | 0 | 5 | ||
資工系 | 493410067 | 74 | 48 | 80 | 202 | 69 | 74 | ||
資工系 | 493410069 | 101 | 67 | 75 | 243 | 80 | 85 | ||
資工系 | 493410083 | 46 | 0 | 41 | 87 | 30 | 35 | ||
資工系 | 493410085 | 86 | 58 | 74 | 218 | 73 | 78 | ||
資工系 | 493410086 | 73 | 41 | 91 | 205 | 71 | 76 | ||
資工系 | 493410087 | 66 | 58 | 91 | 215 | 74 | 79 | ||
資工系 | 493410089 | 56 | 68 | 90 | 214 | 73 | 78 | ||
資工系 | 493410094 | 60 | 46 | 70 | 176 | 60 | 65 | ||
資工系 | 493410096 | 56 | 33 | 92 | 181 | 64 | 69 | ||
資工系 | 493410099 | 47 | 30 | 83 | 160 | 56 | 61 | ||
資工系 | 493410102 | 81 | 67 | 89 | 237 | 80 | 85 | ||
經濟學系 | 493510005 | 85 | 60 | 88 | 233 | 79 | 84 | ||
犯防系 | 493725032 | 43 | 54 | 93 | 190 | 66 | 71 | ||
哲學系 | 494125022 | 89 | 58 | 94 | 241 | 82 | 87 | ||
哲學系 | 494125032 | 54 | 77 | 94 | 225 | 77 | 82 | ||
資工系 | 494410001 | 65 | 36 | 83 | 184 | 64 | 程式比賽 | 71 | |
資工系 | 494410002 | 94 | 56 | 85 | 235 | 79 | 程式比賽 | 86 | |
資工系 | 494410003 | 74 | 58 | 92 | 224 | 76 | 81 | ||
資工系 | 494410004 | 106 | 71 | 84 | 261 | 87 | 92 | ||
資工系 | 494410005 | 45 | 55 | 86 | 186 | 64 | 69 | ||
資工系 | 494410006 | 82 | 63 | 89 | 234 | 79 | 84 | ||
資工系 | 494410007 | 102 | 82 | 91 | 275 | 92 | 97 | ||
資工系 | 494410008 | 84 | 29 | 73 | 186 | 63 | 68 | ||
資工系 | 494410009 | 49 | 70 | 54 | 173 | 57 | 62 | ||
資工系 | 494410010 | 71 | 46 | 85 | 202 | 69 | 程式比賽 | 76 | |
資工系 | 494410011 | 48 | 66 | 92 | 206 | 71 | 76 | ||
資工系 | 494410012 | 67 | 30 | 78 | 175 | 60 | 65 | ||
資工系 | 494410013 | 51 | 54 | 53 | 158 | 53 | 58 | ||
資工系 | 494410014 | 96 | 84 | 88 | 268 | 89 | 程式比賽 | 96 | |
資工系 | 494410015 | 94 | 80 | 92 | 266 | 89 | 94 | ||
資工系 | 494410016 | 88 | 38 | 90 | 216 | 74 | 程式比賽 | 81 | |
資工系 | 494410018 | 59 | 83 | 86 | 228 | 77 | 程式比賽 | 84 | |
資工系 | 494410019 | 83 | 68 | 89 | 240 | 81 | 86 | ||
資工系 | 494410020 | 100 | 72 | 90 | 262 | 88 | 93 | ||
資工系 | 494410021 | 45 | 48 | 81 | 174 | 60 | 65 | ||
資工系 | 494410022 | 82 | 45 | 80 | 207 | 70 | 75 | ||
資工系 | 494410023 | 58 | 15 | 88 | 161 | 57 | 62 | ||
資工系 | 494410026 | 44 | 0 | 79 | 123 | 45 | 50 | ||
資工系 | 494410027 | 67 | 63 | 89 | 219 | 75 | 80 | ||
資工系 | 494410028 | 79 | 55 | 84 | 218 | 74 | 程式比賽 | 81 | |
資工系 | 494410029 | 88 | 29 | 91 | 208 | 72 | 程式比賽 | 79 | |
資工系 | 494410030 | 78 | 68 | 83 | 229 | 77 | 程式比賽 | 84 | |
資工系 | 494410031 | 104 | 81 | 94 | 279 | 93 | 98 | ||
資工系 | 494410032 | 82 | 15 | 75 | 172 | 59 | 64 | ||
資工系 | 494410033 | 46 | 53 | 94 | 193 | 67 | 72 | ||
資工系 | 494410034 | 88 | 78 | 85 | 251 | 84 | 89 | ||
資工系 | 494410035 | 96 | 78 | 89 | 263 | 88 | 程式比賽 | 95 | |
資工系 | 494410036 | 77 | 81 | 93 | 251 | 85 | 90 | ||
資工系 | 494410037 | 69 | 64 | 89 | 222 | 76 | 81 | ||
資工系 | 494410038 | 68 | 13 | 80 | 161 | 56 | 61 | ||
資工系 | 494410039 | 79 | 2 | 87 | 168 | 59 | 64 | ||
資工系 | 494410040 | 70 | 82 | 76 | 228 | 76 | 81 | ||
資工系 | 494410041 | 75 | 71 | 94 | 240 | 81 | 86 | ||
資工系 | 494410042 | 64 | 45 | 85 | 194 | 67 | 72 | ||
資工系 | 494410043 | 85 | 56 | 89 | 230 | 78 | 83 | ||
資工系 | 494410044 | 0 | 0 | 5 | 5 | 2 | 棄選 | 7 | |
資工系 | 494410045 | 76 | 86 | 90 | 252 | 85 | 90 | ||
資工系 | 494410046 | 92 | 74 | 89 | 255 | 85 | 90 | ||
資工系 | 494410047 | 100 | 71 | 94 | 265 | 89 | 程式比賽 | 96 | |
資工系 | 494410048 | 78 | 58 | 90 | 226 | 77 | 82 | ||
資工系 | 494410049 | 106 | 59 | 93 | 258 | 87 | 程式比賽 | 94 | |
資工系 | 494410050 | 92 | 24 | 47 | 163 | 54 | 59 | ||
資工系 | 494410051 | 101 | 77 | 95 | 273 | 91 | 程式比賽 | 98 | |
資工系 | 494410052 | 34 | 42 | 57 | 133 | 46 | 程式比賽 | 53 | |
資工系 | 494410053 | 89 | 72 | 84 | 245 | 82 | 87 | ||
資工系 | 494410054 | 102 | 75 | 90 | 267 | 89 | 94 | ||
資工系 | 494410056 | 87 | 72 | 93 | 252 | 85 | 程式比賽 | 92 | |
資工系 | 494410057 | 72 | 69 | 93 | 234 | 80 | 85 | ||
資工系 | 494410058 | 88 | 57 | 89 | 234 | 79 | 84 | ||
資工系 | 494410059 | 87 | 44 | 65 | 196 | 65 | 70 | ||
資工系 | 494410060 | 64 | 63 | 91 | 218 | 75 | 80 | ||
資工系 | 494410061 | 37 | 10 | 41 | 88 | 31 | 36 | ||
資工系 | 494410062 | 90 | 72 | 78 | 240 | 80 | 85 | ||
資工系 | 494410063 | 83 | 60 | 92 | 235 | 80 | 85 | ||
資工系 | 494410064 | 84 | 50 | 81 | 215 | 73 | 78 | ||
資工系 | 494410066 | 99 | 78 | 90 | 267 | 89 | 94 | ||
資工系 | 494410067 | 98 | 79 | 91 | 268 | 90 | 95 | ||
資工系 | 494410068 | 105 | 83 | 94 | 282 | 94 | 99 | ||
資工系 | 494410070 | 96 | 68 | 88 | 252 | 84 | 89 | ||
資工系 | 494410071 | 65 | 66 | 91 | 222 | 76 | 81 | ||
資工系 | 494410072 | 100 | 66 | 91 | 257 | 86 | 91 | ||
資工系 | 494410073 | 99 | 40 | 91 | 230 | 78 | 83 | ||
資工系 | 494410074 | 57 | 76 | 85 | 218 | 74 | 79 | ||
資工系 | 494410076 | 94 | 61 | 85 | 240 | 81 | 86 | ||
資工系 | 494410077 | 99 | 76 | 91 | 266 | 89 | 94 | ||
資工系 | 494410078 | 99 | 20 | 90 | 209 | 72 | 77 | ||
資工系 | 494410079 | 68 | 54 | 88 | 210 | 72 | 77 | ||
資工系 | 494410080 | 34 | 34 | 74 | 142 | 50 | 55 | ||
資工系 | 494410081 | 89 | 48 | 91 | 228 | 78 | 83 | ||
資工系 | 494410082 | 83 | 57 | 81 | 221 | 74 | 79 | ||
資工系 | 494410083 | 90 | 73 | 92 | 255 | 86 | 91 | ||
資工系 | 494410085 | 35 | 20 | 90 | 145 | 53 | 58 | ||
資工系 | 494410086 | 88 | 58 | 88 | 234 | 79 | 84 | ||
資工系 | 494410087 | 99 | 70 | 91 | 260 | 87 | 92 | ||
資工系 | 494410088 | 74 | 45 | 92 | 211 | 73 | 78 | ||
資工系 | 494410089 | 94 | 69 | 93 | 256 | 86 | 91 | ||
資工系 | 494410090 | 92 | 66 | 91 | 249 | 84 | 89 | ||
資工系 | 494410092 | 92 | 49 | 74 | 215 | 72 | 77 | ||
資工系 | 494410093 | 83 | 59 | 91 | 233 | 79 | 84 | ||
資工系 | 494410094 | 57 | 77 | 91 | 225 | 77 | 82 | ||
資工系 | 494410097 | 59 | 46 | 90 | 195 | 68 | 73 | ||
資工系 | 494410098 | 93 | 52 | 89 | 234 | 79 | 84 | ||
成教系 | 494710021 | 72 | 68 | 87 | 227 | 77 | 82 | ||
資工系 | 493410021 | 0(未修 ) | 60 | 68 | 68 | 68 | 68 | ||
資工系 | 494410095 | 0(未修 ) | 0 | 91 | 91 | 91 | 91 | ||
平均 | 72.99187 | 53.936 | 80.201613 |