Write a C++ program to convert a distance given in miles plus additional feet into kilometers. Use the following values (please, exactly these values – they're not exactly correct but I want your results to exactly match my results) to convert the distances: one mile is 5280 feet, one meter is 3.28 feet (this isn't exactly correct but don't worry about it), and one kilometer is 1000 meters.
1
Expert's answer
2012-09-13T10:08:10-0400
#include <math.h> #include<iostream> using namespace std;
int main() { & float mil,fe,a; int i,j,k; cout<<"Enter the distance in miles: "; cin>>mil; cout<<"Enter additional feet: "; cin>>fe; a=(mil*5280+fe)/3280; cout<<"Distance in kilometers: "<<a<<"\n\n";;
Comments
Leave a comment