Expected primary-expression error

I want my program to tell me the number of TIMES defined in class Dice:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Dice
{
    public:
        static const int TIMES = 10;
        int roll(int TIMES);
};

int main()
{
    Dice game;

    game.roll(int TIMES);
}

int Dice::roll(int TIMES)
{
    cout << "The number TIMES is: " << TIMES;
}


But I get the error

error: expected primary-expression before 'int'


Why does it not work?
At line 12, you're declaring an integer and passing it to the function in an incorrect manner.

If you want to pass TIMES, then write like this: game.roll(Dice::TIMES)

I think you need to learn more about functions before you can fiddle around with classes. Go here: http://www.cplusplus.com/doc/tutorial/functions/
Thank you!

I know about functions, classes etc. just forgot how it all works. Been a while sience I last wrote a program.

And thank you for the link, always good to fresh up the memory a little.

Thanks a lot! :)
Topic archived. No new replies allowed.