+ 1

'h' cannot be used as a function

#include <iostream> #include <cmath> using namespace std; int main() { const double pi = 3.14159265359; double r = 5; double h = 5; double answer; answer = 2 * pi * pow(r , 2) + h (2 * pi * r); cout << answer << endl; return 0; } I've declared all of my variables and creating my program but when I try to run the program i keep getting " 'h' cannot be used as a function".

9th Jul 2017, 4:05 PM
Michael Addante
Michael Addante - avatar
2 Answers
+ 2
2 * pi * pow(r, 2) + h * (2 * pi * r); Is how it should look. Just add an asterisk after the h.
9th Jul 2017, 7:11 PM
Zeke Williams
Zeke Williams - avatar