c++ array question
Posted on 2004-10-26
I have a small problem with some C++ code. I use Microsoft VB 6.0 to compile it, but here is my problem:
I have a Character Array of 22 Characters named people... so
I assigned a unique character to each one of them, for example put lets put a-v in them such that temp=a and temp=b and so on all the way to v.
There are more manipulations that i need to do, but here is the main thing i need help with.
I am going to prompt to user to enter a skip number for example 8.
What i want to do then is go to temp which is character "i" in the example do some of my manipulations and then delete the character out of the array or just set it equal to 0 or something.
Then i want to continue to skip 8 so that i go to people which should be "r" and once i get past the 21 i want to be able to go back to 0 and and go to people which shoud be "e".
Here is where my problem comes in. Now some of the values are 0 or taken out of the array if I add another 8 then temp[4+8] is temp but we took out character "i" and i need to be able to skip i when adding the 8. I want to continue this until there are only Skip number of characters left in the array. So for this example 8.
cout<<"Enter Skip Number: ";
for(int i=0; i<22; ++i)
temp[i] = 'a' + i;
for (i=0; i <22-skip; i++)
Manipulation Code here
That last for loop should make sure that we will do it until there is only skip number of characters left
Any help or input is appriciated