lab10 - #include u using namespace std const int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> # using namespace std; u const int FEET_IN_YARDS = 3; const int YARDS_IN_MILES = 1760; c struct Distance { long feet; long yards; long miles; }; } Distance AddDistance(Distance, Distance); Distance ConvertYards(long); Distance ConvertFeet(long); void PrintDistance(Distance); float MilesPerHour(Distance, long); f //********* Distance Operations ******************** / Distance AddDistance (Distance distance1, Distance distance2) // Pre: distance1 and distance2 contain valid data. // Post: Returns distance1 + distance2. { Distance distance3; distance3.feet = distance1.feet + distance2.feet; distance3.yards = distance1.yards + distance2.yards; distance3.miles = distance1.miles + distance2.miles; d distance3.yards = distance3.yards + (distance3.feet/FEET_IN_YARDS); distance3.feet = distance3.feet%FEET_IN_YARDS; d distance3.miles = distance3.miles + (distance3.yards/YARDS_IN_MILES); distance3.yards = distance3.yards%YARDS_IN_MILES; d return distance3; } //****************************************************** / Distance
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course CECS CIS 150 taught by Professor L.tsui during the Fall '07 term at University of Michigan-Dearborn.

Page1 / 3

lab10 - #include u using namespace std const int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online