DCO20105  Data Structures and Algorithms

Semester A, 2002-3

 

Lab 2 -- Introduction to C++ programming

Objectives:


Laboratory Exercise

  1. For "Practice Problems" of Homework 1 of SSD5:

    1. Identify the ways that quadratic.cc does not follow the conventions.

    2. Change quadratic.cc to follow the conventions and compile and execute it.

    3. Study the program myprog.cc in Lab 1. It is a program for using the operator sizeof().

  2. Work on Algorithms Homework 1.  Answer the question(s) to your tutor in order to get marks.

  3. Download the incomplete program linenumbers.cp.  Study the program with C++ Homework 1. Finish the program and change the input statement in the style as specified in "File I/O" of Homework 1 practice problems.  If you cannot finish this program in the lab, finish it at home and bring your solution to your tutor in next lab.


Supplementary Exercise

The following exercises do not affect your marks but are for the sake of more practice (make perfect) and/or challenge.

  1. Implement the program by using the "more clever algorithm" suggested in question 5 of Algorithms Homework 1. 


 

Marking

2 for quadratic.cc.
1 for answering questions.
1 for starting work on linenumbers.cp.
Marks are awarded according to the completeness and quality of a program/answer.
0 -- absent (without extenuating circumstance) or no participation at all.

 


Copyright © 2002 Rossella KH Lau
Last modified: August 30, 2002