LAB 07B - PRACTICE SRUCTS

Concepts

The goal of this lab is to continue gaining practice with structs.

Instructions

To begin, create an empty project (however fits your fancy!). Then complete the following five TO DO items.

  1. TO DO #1:
    Define a global struct called Measurement with the following two data members:
    1. miles, an integer variable
    2. meters, a long integer variable

  2. TO DO #2:
    Define a global struct called Destination with the following two data members:
    1. city, a string variable
    2. distance, a Measurement variable

  3. TO DO #3:
    First, declare a variable of type Destination in main.cpp. Second, use assignment statements to set the following values:
    1. city: Tupelo
    2. miles: 375
    3. meters: 603,375

  4. TO DO #4:
    Write a function called PrintDest that has one Destination parameter (passed by reference, but not allowed to change) and no return value. This function should then print out the city and the distance in miles and meters. Add the function prototype above your main.cpp and the function definition below your main.cpp.

  5. TO DO #5:
    In your main.cpp, call the function PrintDest with the Destination variable declared in TO DO #3.

As always, we recommend an incremental build strategy. Once TO DO #1 is completed and tested, get TO DO #2 working properly. Once TO DO #2 is completed and tested, move on. And so forth.

This Lab will be due with Homework 07.