title: i fail to add all the volumes of all the shapes and give an option to print the added volumes. C++
body: <p>//Write a program to calculate the total “Volume” of different measures (Shapes) such as cube, sphere, cylinder, and cone. Write separate functions for each shape and return their volume to main for total calculation. Display total volume in the main function.//</p>
  <pre><code>#include&lt;iostream.h&gt;
  
  using namespace std;
  
  #include&lt;conio.h&gt;
  
  class Volume
  
  {
  
   float V;
  
  public:
  
   void cube()
  
   {
  
    float a;
  
    cout&lt;&lt;&quot;Enter value of side&quot;&lt;&lt;endl;
  
    cin&gt;&gt;a;
  
    V=a*a*a;
  
   }
  
   void cuboid()
  
   {
  
    float l,b,h;
  
    cout&lt;&lt;&quot;Enter length,breadth &amp; hight of cuboid&quot;&lt;&lt;endl;
  
    cin&gt;&gt;l&gt;&gt;b&gt;&gt;h;
  
    V=l*b*h;
  
   }
  
   void cylinder()
  
   {
  
    float r,h;
  
    cout&lt;&lt;&quot;Enter radius &amp; hight of cylinder&quot;&lt;&lt;endl;
  
    cin&gt;&gt;r&gt;&gt;h;
  
    V=3.14*r*r*h;
  
   }
  
   void sphere()
  
   {
  
    float r;
  
    cout&lt;&lt;&quot;Enter radius of sphere&quot;&lt;&lt;endl;
  
    cin&gt;&gt;r;
  
    V=(4*3.14*r*r*r)/3;
  
   }
  
   void cone()
  
   {
  
    float r,h;
  
    cout&lt;&lt;&quot;Enter radius &amp; hight of cone&quot;&lt;&lt;endl;
  
    cin&gt;&gt;r&gt;&gt;h;
  
    V=(3.14*r*r*h)/3;
  
   }
  
   void display()
  
   {
  
    cout&lt;&lt;&quot;Volume is = &quot;&lt;&lt;V&lt;&lt;endl;
  
   }
  
  };
  
  int main()
  
  {
  
   while(1){
  
    int ch,q;
  
    Volume ob;
  
    cout&lt;&lt;&quot;Select the shape for calculate volume&quot;&lt;&lt;endl&lt;&lt;endl;
  
    cout&lt;&lt;&quot;Press 1 for select CUBE&quot;&lt;&lt;endl;
  
    cout&lt;&lt;&quot;Press 2 for select CUBOID&quot;&lt;&lt;endl;
  
    cout&lt;&lt;&quot;Press 3 for select CYLINDER&quot;&lt;&lt;endl;
  
    cout&lt;&lt;&quot;Press 4 for select SPHERE&quot;&lt;&lt;endl;
  
    cout&lt;&lt;&quot;Press 5 for select CONE&quot;&lt;&lt;endl&lt;&lt;endl;
  
    cin&gt;&gt;ch;
  
    cout&lt;&lt;endl;
  
     switch(ch)
  
       {
  
           case 1: ob.cube();break;
  
           case 2: ob.cuboid();break;
  
           case 3: ob.cylender();break;
  
           case 4: ob.sphere();break;
  
           case 5: ob.cone();break;
  
           default: cout&lt;&lt;&quot;Wrong input&quot;;
  
            
       }
  
    if(ch&gt;=1 &amp;&amp; ch&lt;=5)
  
     ob.display();
  
    cout&lt;&lt;&quot;press any key to countinue... / press 0 to EXIT&quot;&lt;&lt;endl&lt;&lt;endl;
  
     q=getch();
  
     
    
  
     return 0;
  
    
    
   }   
  
  }
  </code></pre>