Search This Blog

Thursday 28 January 2016

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.

#include<iostream.h>

using namespace std;
class gallon
{
float g;
public:

void data()
{
cout<<"\nEnter number of gallon:";
cin>>g;
}

void feet()
{
cout<<"\nEquivalent cubic feet is:"<<g/7.481;
}
};
int main()
{
gallon ans;
ans.data();
ans.feet();

return 0;
}

No comments:

Post a Comment