Okay, so i need to enter a random number that is in centimeters, this will then be converted into Yards, Feet, and inches... all of these must be integers in the output and should look something along the lines of this.
Example Output:
3 Yard(s) 20 Feet 6 Inches
The outputs im getting include large numbers in inches and feet but nothing in yards, however they are not converted for the propper measurements for each section.
Ive been dinking around with this problem for a couple hours and im just flat out stuck, any help would be appreciated.
Thanks,
Exo1337
My Code:
#include <iostream>
using namespace std;
const int INCHES = 2.54;
const int FEET = 30.48;
const int YARDS = 91.44;
int main()
{
double centimeters;
cout << "Please input a length that will be exspressed in centimeters: ";
cin >> centimeters;
cout << endl;
cout << "You entered: " << centimeters << endl;
cout << static_cast<int> (centimeters / INCHES) << "Inches" << endl;
centimeters = centimeters % INCHES;
cout << static_cast<int> (centimeters / FEET) << "Feet" << endl;
centimeters = centimeters % FEET;
cout << static_cast<int> (centimeters / YARDS) << "Yard(s)" << endl;
centimeters = centimeters % YARDS;
return 0;
}