Hi,
I've wrote a small program to calculate the volume of a hollow metal "tube."
Here is my code:
The result = line is the one giving me problems, but I don't see what's wrong with it
It gives me the invalid arguement of 'unary *' error, as well as some "expected ) before ;" and "expected ; before (" errors as well.
Thanks for any help, I really appreciate it.
*EDIT*
Fixed it somehow.
I've wrote a small program to calculate the volume of a hollow metal "tube."
Here is my code:
Code:
#include <iostream>
#include <cmath>
using namespace std;
#define pi 3.141592654;
int main () {
float r,t,h,result; // radius, thickness, height
// the measurements
r = 5.0;
t = 3.0;
h = 10.0;
// doing the math
result = (pi*pow(r+t,2)*h)-(pi*pow(r,2)*h);
// return the result
cout << "The required amount of metal is: \n" << result << " cubic centimeters.\n";
return 0;
}
The result = line is the one giving me problems, but I don't see what's wrong with it
It gives me the invalid arguement of 'unary *' error, as well as some "expected ) before ;" and "expected ; before (" errors as well.
Thanks for any help, I really appreciate it.
*EDIT*
Fixed it somehow.