Thursday 5 January 2017

Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.

Leave a Comment


Question:

Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.

Explanation:

Below mention code is compiled in Visual Studio 2015 and Code Blocks 13.12,output snap is attached.. If any problem you feel and you want some explanation feel free to contact us.

Code:

/**************************************************|
/*************C++ Programs And Projects************|
***************************************************/
#include <iostream>
using namespace std;
int main()
{
       float gallons, cufeet;
       cout << "\nEnter quantity in gallons : ";
       cin >> gallons;
       cufeet = gallons / 7.481;
       cout << "Equivalent in cublic feet is " << cufeet << endl;
       return 0;

}

Output:



Related Articles:

Object-Oriented Programming in C++ Fourth Edition By Robert Lafore Solution Manual

C++ Books Solution

If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: