Two problems here:
1) You never create an instance of your class. This is needed somewhere near the top of main with the rest of your variables:
|
counterType my_countertype; // Creates a new counterType object called my_countertype
|
2) Yeah, you're right. Your function calls aren't right. Partly due to problem 1, but also they're syntactically wrong. So we'll use the object we've just created and call one if it's functions:
|
my_countertype.counterPlus(1); // You'd pass in whatever number you like here.
|
You probably want to change the name of your parameters too, so that they don't match the class variable:
1 2 3 4
|
int counterType::counterMinus (int n)
{
// Code here
};
|
In fact, if it's only ever adding or subtracting 1 from count, you don't need parameters at all. You could, however, use parameters to your advantage in your counterSet function. Have a go, if you don't see what I mean then post back and I'll show you.
One final thing, you can remove the int keyword from your constructor. Just having count = 0 will initialise the count variable in that class to 0. It would also be good practice to make the variables in your class private.
EDIT: Also, your while loop logic doesn't match up. When the loop starts over, count won't = 0, unless you reset it.