I am trying to compile this in DevC++ but I keep getting hung up with the error..
" 'h' cannot be used as a function." Is there something I`m missing? I`ve been assigning different letters to equations all night and this is the first problem I`ve had. Thanks for the help. Plain
Code:
//Here's a piece on horizontal cylinders, circular and elliptical,
//that may be
//what you want.
//Consider a circle of radius a (the end of the tank)
//and imagine that the liquid
//has reached
//height h, measured from the lowest point on the circle.
//Note that 0 <= h <= 2a. The area A
//of the segment of the circle covered by the liquid is
//A = pi*a^2/2 - a^2*arcsin(1-h/a) - (a-h)*sqrt(h(2a-h)).
//Note: your calculator should be set in radians.
//Now multiply A * L.
//This program calculates the partial volume of a horizontal cylinder.
//a = r, h = measured liquid
//
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double fillvol;
double pi = 3.141592;
double r;
double h;
double L;
cout << "Enter the radius of the circular cylinder in ";
cout << "decimal feet: ";
cin >> r;
cout << "The circular area of the cylinder is: ";
cout << ((r * r) * pi) << "feet.\n";
cout << "Enter the height of the liquid in decimal feet: ";
cin >> h;
cout << "The liquid height is " << h << "feet.";
cout << "Now enter the length of the cylinder: ";
cin >> L;
cout << "The volume of liquid in the cylinder is: ";
cout << L * ((pi * ((r*r)/2)) - ((r*r)*(asin(1-(h/r))) - (r-h)*sqrt(h(2r-h))));
cout << "cubic feet";
system("PAUSE");
return 0;
}