feet meters yards conversion help!!!!!

I am very new to this and am taking classes online and this is my assignment, I'm not trying to cheat cuz below you see i have tried it myself and i have also tried to contact my teach for help and she just says read the book...>> which i already have and made this below but it doesnt work. I don't want you to do my work I just wanna understand HOW to do this. Plz help me, thank you. This is what I have to do:

Output each of the sub totals individually….(i.e. Miles, Yards, Feet, Inches) Then output the grand
total.
Units Value Meters
Miles XXX XXX.XX
Yards XXX XXX.XX
Feet XXX XXX.XX
Inches XXX XXX.XX
Total XXX XXX.XX

results for the following:
3 miles 105 yards 235 feet 11 inche

To limit your output to 2 decimal places
This is what I got so far..and i know im doing something wrong, plus i dont know how to work in the constants plz help.




#include <iostream>
#include <iomanip>
using namespace std;

int main ()
{
double f =3.14159;
cout << fixed;
cout << setprecision(2) << f << endl;

const int YARDS_PER_MILE = 1760;
const int FEET_PER_MILE = 5280;
const int FEET_PER_YARD = 3;
const float METERS_PER_INCH = 0.0254;
const int INCHES_PER_YARD = 36;

if
double yards;
double meters;


cout << "Enter the yards:";
cin >> yards;

meters = yards*INCHES_PER_YARD*METERS_PER_INCH;
cout << yards << “yards is” << meters << “meters.”;

system(“pause”);

return 0;

}
Last edited on
That 'if' is random..
What exactly is the problem. You seem to deal with yards fine. The rest are the same..
Topic archived. No new replies allowed.