|
|
DT249-1 Programming and Algorithms
Week 09
Learning Outcomes:
Upon completion of this class, you should be able to:
- Describe the need for structures in computer programs.
- Define and declare structures.
- Instantiate structures.
- Set members of structures to certain values.
- Pass structures to functions by value.
- Pass structures to functions by reference.
- Create arrays of structures.
Tasks
|
1. |
Complete the tasks from
last week. |
|
2. |
Download the code for
this week's notes. Go through all the code, compiling and running each
program separately. If you have any problems, ask the lab supervisor
for help, or take a note of the problem and we can discuss it in next
week's class. The code is bundled into a ZIP
file. This is a compressed file which contains all the separate source
code files. To open this file and extract the contents, you can use
the WinZip tool which is available in the lab, and is available for
free download here.
Make sure to put all your code into a folder named
week_9 in your programming folder on your u: drive.
|
|
3. |
Create a structure to represent a library book - ISBN
number, author, year etc. |
|
4. |
Create a function that takes a pointer to a library
book and prompts the user to enter the details. |
|
5. |
Create a program which takes as a command line argument
the number of books in the library, and then gets the user to enter
the details for each of the books. |
|
6. |
Start redesigning your first assignment so that it uses
structures and functions. |
Further Reading
Chapter 12 of Paul Kelly book
|