Question #5711

write a program to compute the volume of a cylindrical fuel tank. the formula required is

volume = pie r square h;

where pie is 3.142

r is the radius of the tank

h is the height of the tank

your program should have a function called computevolume

volume = pie r square h;

where pie is 3.142

r is the radius of the tank

h is the height of the tank

your program should have a function called computevolume

Expert's answer

// Volume of a cylindrical fuel tank.cpp : Defines the entry point for the

console application.

//

#include "stdafx.h"

#include

"conio.h"

#include <iostream>

using namespace std;

double

volume;

double pie=3.14;

double computevolume(double r,double

h){

volume = pie*r*r*h;

return volume;

}

int _tmain(int argc,

_TCHAR* argv[])

{

double r;

double h;

cout<<"Enter r of

cylindrical fuel tank: ";

cin>>r;

cout<<"Enter h of

cylindrical fuel tank: ";

cin>>h;

cout<<"The volume of a

cylindrical fuel tank: "<<computevolume(r,h);

getch();

return

0;

}

console application.

//

#include "stdafx.h"

#include

"conio.h"

#include <iostream>

using namespace std;

double

volume;

double pie=3.14;

double computevolume(double r,double

h){

volume = pie*r*r*h;

return volume;

}

int _tmain(int argc,

_TCHAR* argv[])

{

double r;

double h;

cout<<"Enter r of

cylindrical fuel tank: ";

cin>>r;

cout<<"Enter h of

cylindrical fuel tank: ";

cin>>h;

cout<<"The volume of a

cylindrical fuel tank: "<<computevolume(r,h);

getch();

return

0;

}

## Comments

## Leave a comment