C Write a console program that converts meters into feet and

[C++]

Write a console program that converts meters into feet and inches. The program starts by asking the user for a measurement in meters. The program should accept a floating point number. After getting the number, the program computes the number of feet and inches equal to the specified number of meters. The program outputs feet and inches as whole numbers. The program should round the number of inches correctly. Test that your program produces the following outputs for the given inputs.

Solution

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
double meter;

cout<<\"Enter the meter value : \";
cin>>meter;

double floatFeet = meter* 3.28084;
int feet = (int)floatFeet;
int inches = round((double)((floatFeet - feet) * 12.0 ));
if(inches == 12){
feet = feet + 1;
inches = 0;
}
cout << feet << \"ft \" << inches << \"in \";
return 0;
}

[C++] Write a console program that converts meters into feet and inches. The program starts by asking the user for a measurement in meters. The program should a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site