Letter.
, COS1512/101/3/2011
IMPORTANT INFORMATION
Read this tutorial letter first.
It contains the compulsory assignment.
SCHOOL OF COMPUTING
COS1512
Introduction to Programming 2
IMPORTANT INFORMATION: READ NOW
This is a semester module.
Plan to spend at least 8 hours per week on this module.
To be considered for examination admission in COS1512, a student must meet the following
requirement:
Submit assignment 1 BEFORE 14 March 2011 (first semester registration)
OR
Submit assignment 1 BEFORE 22 August 2011 (second semester registration)
Tutorial Letter 101:
First Tutorial Letter
, 2
This tutorial letter (COS1512/101/3/2011) as well as tutorial letter COSALLF/301/4/2011 contains important
information that you are going to need during the year. Please read them carefully.
Another publication which can be of real help is the brochure My studies@ Unisa. It contains information
about microcomputer laboratories, the library, myUnisa, assistance with study skills, et cetera.
Contents
1 Introduction ................................................................................................................................................................... 4
2 Purpose and outcomes of this module .......................................................................................................................... 4
3 Tutorial Matter .............................................................................................................................................................. 6
3.1 Tutorial matter supplied by Unisa .......................................................................................................................... 6
3.2 Prescribed book ...................................................................................................................................................... 6
3.3 Prescribed software ................................................................................................................................................ 7
4 Additional Reading ........................................................................................................................................................ 7
5 Student Support ............................................................................................................................................................. 7
5.1 Communication with the University ...................................................................................................................... 7
5.2 Contacting the lecturers .......................................................................................................................................... 8
5.3 The COS1512 home page ...................................................................................................................................... 8
5.4 myUnisa ................................................................................................................................................................. 9
5.5 Student support systems ......................................................................................................................................... 9
5.6 Study groups .......................................................................................................................................................... 9
6 Study Programme ........................................................................................................................................................ 10
6.1 Syllabus ................................................................................................................................................................ 10
6.2 Practical work ...................................................................................................................................................... 11
6.3 Workshop ............................................................................................................................................................. 11
6.4 Planning your academic year ............................................................................................................................... 11
6.5 Hints on studying this module .............................................................................................................................. 12
7 Examination ................................................................................................................................................................. 13
7.1 Examination Admission ....................................................................................................................................... 13
7.2 Examination period .............................................................................................................................................. 13
7.3 Year mark ............................................................................................................................................................. 14
7.4 Tutorial letter with information on the examination ............................................................................................. 14
8 The Assignments .......................................................................................................................................................... 14
Assignment 1 (First Semester) .............................................................................................................................................. 17
, 3 COS1512/101/3/2011
Assignment 2 (First semester) .............................................................................................................................................. 21
Assignment 3 (First Semester and Second Semester) ......................................................................................................... 26
Assignment 1 (Second Semester) .......................................................................................................................................... 33
Assignment 2 (Second Semester) .......................................................................................................................................... 36
Assignment 3 (Second semester ) ......................................................................................................................................... 40
Appendix A: Installing the Software for COS1512 ............................................................................................................ 41
1. Software for COS1512 ................................................................................................................................................... 41
2. Installing the software .................................................................................................................................................... 42
Method 1 ............................................................................................................................................................................ 42
Method 2 ............................................................................................................................................................................ 42
Uninstalling ........................................................................................................................................................................ 43
3. Using the software .......................................................................................................................................................... 43
Step 1. Starting Dev-C++ .............................................................................................................................................. 43
Step 2. Setting the options ............................................................................................................................................. 43
Step 3. Creating a project............................................................................................................................................... 44
Step 4. Editing a C++ source file ................................................................................................................................... 44
Step 5. Compiling the program ...................................................................................................................................... 45
Step 6. Running the program ......................................................................................................................................... 46
Troubleshooting ............................................................................................................................................................. 46
4. Separate Compilation: Creating Dev-C++ Projects with Multiple Files......................................................................... 47
5. Using the debugger in Dev-C++ ..................................................................................................................................... 51
What is a debugger? ...................................................................................................................................................... 51
How to use the debugger with a program ...................................................................................................................... 51
The windows that display debug-related information .................................................................................................... 51
How to use the debugger ............................................................................................................................................... 51
6. Printing ........................................................................................................................................................................... 54
Method 1 ........................................................................................................................................................................ 54
Method 2 ........................................................................................................................................................................ 54
7. Frequently Asked Questions ........................................................................................................................................... 54
Appendix B: How to install the software on Vista .............................................................................................................. 57
Appendix C: How to install the software on Windows 7: .................................................................................................. 60
Appendix D: Source listings of the sample programs in the textbook .............................................................................. 60
Appendix E: Solution to assignment 3 ................................................................................................................................. 63
Appendix F: Study Guide ..................................................................................................................................................... 86