Q:

write c++ program that asks the user to enter the length, width, and height of a BOX. After the user enters the required parameters, the program calls a float-type function computeVolume(length, width, height) that returns the value of the BOX's VOLUME

0

write c++ program that asks the user to enter the length, width, and height of a BOX. After the user enters the required parameters, the program calls a float-type function computeVolume(length, width, height) that returns the value of the BOX's VOLUME. the program then prints out the value of the volume.

V=w*h*l

 

output Sample:

--------------------------

Enter the length of the box: 2.4

Enter the width of the box: 3.1

Enter the height of the box: 5

the volume of the BOX is 37.2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;

int main()
{
    float computeVolume(float,float,float);  //function prototype
    float length,width,height;
    cout<<"welcome, Enter the length of the box : ";
    cin>>length;
    cout<<"\nwelcome, Enter the width of the box : ";
    cin>>width;
    cout<<"\nwelcome, Enter the height of the box : ";
    cin>>height;

    float v=computeVolume(length,width,height);           //function calling

    cout<<"\nThe volume of the BOX is "<<v;

    return 0;
}

float computeVolume(float length, float width, float height)
{
    float volume=length*width*height;
return(volume);
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now