hi everyone...can i ask question a liltle bit about class in c++..i really have problem in coding my programme...i got errors at here :
int calcFactorial::calcSum(int one, int two, int three)
{
cout<<"enter a positive integer"<
What are the error messages? Are `num' and `factorial' global? They aren't defined within the method, so that may be the issue. A possible ZeroDivison Error can occur when num is equal to 1, in the line `fact = ((num*factorial)(num-1));'
are `num' and `fact' declared ** typo sorry (I said factorial instead of fact )
fact, factorial and num ( in the posted code ) aren't defined properly. A class is it's own namespace, so cout and cin aren't defined, you probably want std::cout, std::endl and std::cin. one, two and three aren't used, that's probably just a warning. In the line: fact=((num*factorial)(num-1)) ; there's no operator between the two sets of inner parentheses.
Join our real-time social learning platform and learn together with your friends!