samedi 1 juillet 2017

scan through the array a particular amount of times then cout the element

i want to count a particular element and see where it stops for example, i have 1,2,4 the output value is 1 because when ever it reaches the end of the array it starts all over again and continues counting i hope this makes sense this is what i have so far:

========================================================================

int numbers[] = {1,2,3,4};
int count =0;
int K =5;

while (count !=k)
{
 //dont know what to do here
}

Please explain the logic as well i am unable to get this.

Aucun commentaire:

Enregistrer un commentaire