Pointer Question

I have most of what I'm supposed to do done, however, the output is slightly off for my for loop in my program. I'm supposed to print every "nth" element that the user wants printed from the array. I'm supposed to use pointers instead of indexes.



1
2
3
4
5
  cout << "\n\nEnter a step: ";
    cin >> step;
    cout << "\nThe nth element of the array is:\n";
    for (pointer = array; pointer < array + (10); pointer += step)
        cout << *pointer << " ";



The output includes the first element of the array, which I'd like to exclude from the output. I understand that the pointer is being set to the address to the first element of the array, but how can I make it so it looks at each element, so if I entered 2 for step, the output would print every second element? Any help is appreciated.
for (pointer = array + step - 1; pointer < array + (10); pointer += step)
Thank you very much!
Topic archived. No new replies allowed.