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;
will prevent it from working at all. It's normally used like this
if(boolean_expression)
{
// code
}
After that, recognize what the problem asks. Unless you're just testing part of the solution right now by converting only yards to meters, you also need to determine how many meters are in 3 miles, how many meters are in 235 yards, how many meters are in 11 inches, and finally the total of these quantities in meters.
A more minor matter you might then address is to put spaces in your strings so that the numbers don't run into the words. Also, try to keep the same problem in one thread rather than four. It's easier to build something up and it's more nicely organized.