Help with an array

How would one go about creating an array that cycles through the same numbers?
for example {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,etc} for a chosen length?
Try looking up "enum" in the C++ documentation.
Last edited on
Something like this?

1
2
3
4
5
6
7
8
9
10
#define ARRAY_LENGTH (15)
#define REPETITION_LENGTH (10)

...

int array[ARRAY_LENGTH];
for (int i = 0; i < ARRAY_LENGTH; ++i)
{
    array[i] = (i % REPETITION_LENGTH);
}
Topic archived. No new replies allowed.