Question: This assignment is about writing functions (Chapter 3). Revisit your Assignment 1 to convert from miles to kilometers. Modify the program so that a function
This assignment is about writing functions (Chapter 3). Revisit your Assignment 1 to convert from miles to kilometers. Modify the program so that a function is used to do the conversion rather than have the conversion done in the main function. You will need a function called convertMilestoKilometers. The function takes one argument called miles of type float and returns a float. Make sure to declare this function in the prototype section at the top of the program like this: float convertMilestoKilometers(float miles).; Next, after the main function, include the full definition of this function so that it converts the value stored in its formal parameter miles to kilometers and returns kilometers. After this, modify the main function so that it calls the function convertMilestoKilometers to convert from miles to kilometers Finally, test your updated program to ensure that the conversion is done correctly like this: Please enter the number of miles> 3 The number of kilometers = 4.83
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
