Thanks Lynx! I see what you mean there. I was having a brain fart moment and now I've got it! I truly do appreciate you checking in and helping me out with this! It's been driving me nuts all day lmao This is a rather simple program to write and it baffles me to think that I couldn't understand it.
Below is the code that I fixed and I'm sticking with. This is for a test, so I can't have too much help, but having a fresh pair of eyes on the code really helps me find the problems that I made.
-----------------------------------------------------------------------------------------------
#include <iostream>
#include <cmath>
using namespace std;
double cylinderWaterWeight(double,double );
int main()
{
cout << "Please enter the height using inches: ";
double height;
cin >> height;
cout << "Please enter the diameter using inches: ";
double diameter;
cin >> diameter;
cout << "\n";
cout << "|-----------------|" << endl;
cout << "| Calculting |" << "\n";
cout << "|-----------------|" << endl;
cout << "\n";
double weight = cylinderWaterWeight(height, diameter);
cout << "The weight of the cylinder is: " << weight << endl;
system("pause");
return 0;
}
double cylinderWaterWeight(double height, double diameter)
{
// The site I obtained the conversion was from
//
http://www.engineeringtoolbox.com/water-density-specific-weight-d_595.html
double volume = height * M_PI * diameter * diameter / 4.0;
const double density = 1.936;
double waterWeight = volume * density;
return waterWeight;
}