Answer:
#include <iostream>
using namespace std;
void miles_to_km(float &miles)//function to convert miles to kilo meters.
{
miles=miles*1.6;
}
int main() {
float miles;
cout<<"Enter the miles"<<endl;
cin>>miles;//taking input of the miles..
miles_to_km(miles);//calling function that converts miles to km..
cout<<"The number of km is "<<miles<<endl;//printing the km.
return 0;
}
Output:-
Enter the miles
54
The number of km is 86.4
Step-by-step explanation:
I have created a function miles_to_km of type void which has the argument miles passed by reference.In the function the variable miles is converted to kilo meters.Then in the main function the function is called with the value prompted from the user.Then printing the changed value.