431,965 Members | 2,043 Online
Need help? Post your question and get tips & solutions from a community of 431,965 IT Pros & Developers. It's quick & easy.

# Urgent help on errors on variable definitions (declarations) and arithmetic operation

 P: 1 This is a code to do for extra practice before we go to our lab tomorrow morning. Our professor said if we can get through this practice example, the lab shouldn't be too difficult tomorrow. However, I keep running into errors (mainly syntax) or being told that I have illegal characters. Any and all help is much appreciated. /* Name Section 001R Program to calculate the volume of a whole propane tank by adding the volume contained in the cylinder and the volume contained in each of the hemispheres. input: length of cylinder and the radius of the cylidner output: volume of the whole tank processing: volume = pi*r^2*l + 2(2/3(pi*r^3)). Pi is 3.14159 */ #include #include using namespace std; int main() { //Constant for PI const double PI = 3.14159; // Variables long length, // length of the cylinder radius, // radius of the cylinder volume, // volume of the propane tank // Set the desired output formatting for numbers ; cout << fixed << setprecision(4); // Prompt the user for the cylinder's length and radius. cout << "Enter the units of these dimensions :\n"; cin >> meters; cout << "Please enter length and radius "; cin >> length >> radius; //Calculate the propane tank's volume. volume = PI * radius * radius * length + 2 * (2 / 3)*PI*radius * radius * radius //Display the calculated data. ; cout << "The volume of the propane tank is "; cout << volume << "cubic meters.\n"; return 0; } Jan 25 '18 #1