Link to the DIT Home Page

Dublin Institute of Technology, School of Computing
Ciarán O'Leary

  Home -> Teaching -> DT249-1 Programming and Algorithms -> Notes -> Week 09
  DT249-1 Programming and Algorithms

Week 09


Learning Outcomes:

Upon completion of this class, you should be able to:

  1. Describe the need for structures in computer programs.
  2. Define and declare structures.
  3. Instantiate structures.
  4. Set members of structures to certain values.
  5. Pass structures to functions by value.
  6. Pass structures to functions by reference.
  7. 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

 

Hit Counter  [Home][School of Computing][Dublin Institute of Technology]