Thread: Volume always coming 0

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Cryptanalyst
    Join Date
    Sep 2007
    Posts
    52

    Volume always coming 0

    In a nutshell,this is the code of the area,lateral area and volume of a cone from a class structure -:
    Code:
    else if(g[0] == 'N' || g[0] == 'n')
                            {
                                   cout << "Enter radius of the cone - ";
                                   cin >> a;
                                   cout << "\nEnter slant height of the cone - ";
                                   cin >> b;
                                   cout << "\nEnter perpendicular height of the cone - ";
                                   cin >> x;
                                   float Area = (M_PI * a) * (a + b);
                                   float L_area = M_PI * a * b;
                                   float Volume = 1/3 * M_PI * pow(a,2) * x;
                                   cout << "\nThe CSA is " << L_area << endl;
                                   cout << "The TSA is " << Area << endl;
                                   cout << "The volume is " << Volume << endl;
                            }
    But the volume keeps coming 0 for whatever value I put..I don't seem to find anything wrong..help please
    Last edited by SVXX; 10-04-2007 at 05:19 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 06-09-2009, 12:55 AM
  2. How to know if a volume is mounted with ACL enabled
    By rak1986 in forum Linux Programming
    Replies: 0
    Last Post: 04-08-2009, 12:45 AM
  3. Volume of a Cone Equation always equals 0
    By Devolution in forum C Programming
    Replies: 11
    Last Post: 01-28-2009, 03:13 AM
  4. Help! Right Math, Wrong Output
    By verd in forum C Programming
    Replies: 12
    Last Post: 03-15-2005, 07:49 PM
  5. What am I doing wrong? Help please...
    By SprinterSteve in forum C Programming
    Replies: 9
    Last Post: 04-17-2003, 09:35 PM