Hello guys. I just have a problem that I think you pros will help me solve real quick..
I was instructed to make a table that will show the inputed miles, yards, feet, and inches this way:
Units Value Meters
Miles XXX XXX.XX
Yards XXX XXX.XX
Feet XXX XXX.XX
Inches XXX XXX.XX
Total XXX XXX.XX
This is what I have, but I cant seem to do the calculations. I get error C2296 and C2297. I dont see whats wrong with it really.
Thanks in advance.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
const int FEET_PER_MILE = 5280;
const int YARDS_PER_MILE = 1760;
const int FEET_PER_YARD = 3;
const int INCHES_PER_YARD = 36;
const float METERS_PER_INCH = 0.0254;
double miles;
double yards;
double feet;
double inches;
double meters, meters2, meters3, meters4;
double totalmeters;
cout <<"Please enter the miles: \n";
cin >>miles;
cout <<"Please enter the yards: \n";
cin >>yards;
cout <<"Please enter the feet: \n";
cin >>feet;
cout <<"Please enter the inches: \n";
cin >>inches;
cout <<"\n\n";
cout <<"Units\t\tValue\t\tMeters\n\n\n";
cout <<"Miles\t\t"<<miles<<"\t\t"<<meters = miles*YARDS_PER_MILE*INCHES_PER_YARD*METERS_PER_INCH235<<"\n\n";
cout <<"Yards\t\t"<<yards<<"\t\t"<<meters2 = yards*INCHES_PER_YARD*METERS_PER_INCH<<"\n\n";
cout <<"Feet\t\t"<<feet<<"\t\t"<<meters3 = feet/FEET_PER_YARD*INCHES_PER_YARD*METERS_PER_INCH<<"\n\n";
cout <<"Inches\t\t"<<inches<<"\t\t"<<meters4 = inches*METERS_PER_INCH<<"\n\n\n";
cout <<"Total\t\t"<<"\t\t"<<totalmeters=meters+meters2+meters3+meters4;
cout <<"\n\n";
system ("pause");
}