โ Back to Functions
Question 398
Convert Kilometers to Miles
Convert Kilometers to Miles
Write a functiondouble toMiles(double km)that converts kilometers to miles by multiplying by0.621371. Call it withtoMiles(10.0)and print the result with exactly 2 decimal places: 6.21 Use<iomanip>fixedandsetprecision(2).
Expected Output:
6.21
Topics:
Functions
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.