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.
- TO DO #1:
Define a globalstructcalledMeasurementwith the following two data members:-
miles, an integer variable -
meters, a long integer variable
-
- TO DO #2:
Define a globalstructcalledDestinationwith the following two data members:-
city, a string variable -
distance, aMeasurementvariable
-
- TO DO #3:
First, declare a variable of typeDestinationinmain.cpp. Second, use assignment statements to set the following values:-
city: Tupelo -
miles: 375 -
meters: 603,375
-
- TO DO #4:
Write a function calledPrintDestthat has oneDestinationparameter (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 yourmain.cppand the function definition below yourmain.cpp.
- TO DO #5:
In yourmain.cpp, call the functionPrintDestwith theDestinationvariable 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.