Your code is still incorrect.
To define a member function of a class, you have to indicate it belongs to the class.
In your header.cpp file, line8, replace
void calculate()
with
void mymath::calculate()
.
To use it in your main() function, since it's a class member function you must first declare an object of the class to be able to use it:
1 2 3 4 5 6 7 8
|
int main(void)
{
mymath MyObject;
MyObject.calculate();
return 0;
}
|
As for your previous problem, it came from that:
cout << calculate << endl;
.
If the function had returned something, you may have wanted to write
cout << calculate() << endl;
, but you forgot the parentheses.
As it turns out, in C/C++ the name of a function is seen as a variable that behaves like a pointer and whose value is the address of the function's code in memory.
When you wrote
cout << calculate << endl;
the compiler thought you wanted to display that address.