Question: Define a function ConvertLength ( ) that takes one integer parameter as totalMeters and two integer parameters passed by reference as kilometers and meters. If

Define a function ConvertLength() that takes one integer parameter as totalMeters and two integer parameters passed by reference as kilometers and meters. If totalMeters is negative, the function returns false without updating the parameters. Otherwise, the function converts totalMeters to kilometers and meters, and then returns true.
Ex: If input is 5100, then output is:
5 kilometers and 100 meters
Notes:
totalMeters /1000 computes the number of kilometers, and totalMeters %1000 computes the remaining meters.
A non-negative number is greater than or equal to 0. c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!