Assuming that there are 7.481 gallons in a cubic foot, write a program that asks the user to enter the number of gallons and display the equivalent in cubic feet.
1
Expert's answer
2011-07-04T05:42:22-0400
#include #include using namespace std;
int main() { double gallons; cout << "Please enter the number of gallons: "; cin >> gallons; if (cin.fail()) { cout << "Invalid number of gallons." << endl; return 1; }
double cubic_feet = gallons / 7.481; cout << "The number of cubic feet is " << setprecision(3) << cubic_feet << endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment