It is supposed to take a ceral box measurement in ounces and convert it to metric tons, as well as tell how many boxes it would take to equal a metric ton. Here it is.
#include <iostream> using namespace std; double ounces; cout << "Enter the box weight in ounces and press enter"; cin >> ounces; double weightInMetricTons, numberOfCerealBoxes; weightInMetricTons = ounces/35273.92; numberOfCerealBoxes = 35273.92/ounces; cout << "The weight in metric tons is/n" << weightInMetricTons << "and it takes/n" << numberOfCerealBoxes << "to equal a metric ton";
For some reason when I hold the mouse over the line that says that weightInMetricTons and numberOfCerealBoxes are doubles, it says that they are both integers, (they are supposed to be doubles). When I hold the mouse over the variable ounces though, it says that it is a double. A double / a double should be a double, right?
The program fails to build. I tried starting at the end, and cutting sections out to see where the problem started, but I got all the way to the beginning so the only lines were:
using namespace std;
and it still failed to build. Is this normal, or does that have to be some content in the program for it to actually build. Any answers to these questions would be greatly appreciated.