Program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.
C++ programs:
Source code:
Solution:
#include<iostream> // iostream is a header file of standard input output function.
#include<conio.h>
using namespace std;
// Th execution of program start with the main function
int main(){
// Data type
int gallons;
float cubicfeet;
// cout used to display the same statemnet in the output.
cout<<"Please Enter number of gallons :";
// Cin used to enter a value by the user.
cin>>gallons;
// Formula of cubic feet
cubicfeet=7.481*gallons;
cout<<endl<<"Cubic Feet in "<<gallons<<" gallons is: "<<cubicfeet<<endl;
// endl is used to enter the next line character.
return 0;
}
Code Screenshot:
0 Comments