Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I wanna calculate 5 volume of the cone , but my print out is zero. can I know wh

ID: 3773633 • Letter: I

Question

I wanna calculate 5 volume of the cone , but my print out is zero. can I know why? Here's my code

#include < iostream >
#include < conio.h >

#define pi 3.142
using namespace std;

void volume_cone(double &radius,double &Height,double &Volume)
{
  
   Volume=1/3*pi*radius*radius*Height;
  
   cout<<Volume<<endl;

}
//************************************************************************
void main()
{
  
   double height=1.00;
   double volume;
   double radius=3.00;


   for(int i=0;i<5;i++){  
           volume_cone(radius,height,volume);
           height++;
               }
   cout<<endl;

   _getch();
}

Explanation / Answer

Please remove Volume parameter from sub function.

volume_cone();

It solves your problem..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote