Classes with CounterType

Hi. I am having some issues with my code and when I compile it it gives me these three errors:
line 21: error: expected primary-expression before ‘int’
line 22: error: expected primary-expression before ‘int’
line 23: error: expected primary-expression before ‘cout’

Your help would be much appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  
#include <iostream>
using namespace std;

        //
        //
        //
        //
class CounterType
{
        public:
        int counter;
        CounterType();
        CounterType(int c);
        void increment(int c);
        void decrement(int c);
        void print (ostream cout);
};
int main()
{
        CounterType ctObj;
        ctObj.increment(int c);
        ctObj.decrement(int c);
        ctObj.print(ostream cout);
}

CounterType::CounterType()
{
        counter = 0;
}

CounterType::CounterType(int c)
{
        counter = c;
}

void CounterType::increment(int c)
{
        counter++;
}

void CounterType::decrement(int c)
{
        counter--;
}

void CounterType::print(ostream Os)
{
        Os << counter << endl;
}
Your function declaration (line 17) and definition (line 47) don't match.
Thanks. I appreciate it
Topic archived. No new replies allowed.