Need Help with constant array size

Hello, this is my coding so far and I am confused to what the constant for array size is


//initialize arrays
string states[ARRAY_SIZE]={"Alabama", "Alaska", "Arizona"};

string capital[ARRAY_SIZE]={"Montgomery", "Juneau", "Phoenix"};

while (play again) {

//generate random index number
int index = rand () % _______

what goes after the rand () % ?

thankyou
Arrays are indexed starting at 0, so:
capital[0] is Montgomery. capital[1] is Juneau and so on. capital[2] is Phoenix.

This means you need to generate a random number between [0, 2] to get a random element from the array. So the answer is simple, the number you need is the ARRAY_SIZE itself.
Topic archived. No new replies allowed.