D
da Vinci
OK, this is a pretty weird question, but shouldn't be to hard to
accomplish. Remember, I am a beginner so please, if I say something
stupid, be gentle.
I do not know vectors yet, which would probably be a better idea than
an array for this, but I want to try using an array for now and then
will update it once I learn vectors. I havent really learned arrays
yet either....
So here it is.... I want to read in a string of characters into an
array. Then take that string of letters and remove all double +
letters. Meaning, you type in BLURRY and you end with BLURY (there
were two R's so one is removed). Then, I want to mix them all up.
So, three main stages. 1. Input 2. Remove doubles - tripples - ect.
and 3. Mix em up.
The input is pretty easy. I could use a for loop but then I would have
to have a set number of input characters, correct? I am using this
right now.....
char x = 'a';
int y = 0;
while ( a != '*' )
{
cin >> arrayname[y];
y++;
}
So they would input the characters until they were done and then add *
at the end. Then I can just discard the last entry into the array.
That will pull in my characters.
Now, no idea how I will remove like items. Maybe feed each element
into a new array and check for doubles as I go? Any good ideas here?
Then, how to mix them up.... I was thinking of using the srand and
rand to generate a random number based off an entered seed number and
grab that element number from the first array and insert it in order
in a new array.
So, how bad have I screwed up the logic on this one?
accomplish. Remember, I am a beginner so please, if I say something
stupid, be gentle.
I do not know vectors yet, which would probably be a better idea than
an array for this, but I want to try using an array for now and then
will update it once I learn vectors. I havent really learned arrays
yet either....
So here it is.... I want to read in a string of characters into an
array. Then take that string of letters and remove all double +
letters. Meaning, you type in BLURRY and you end with BLURY (there
were two R's so one is removed). Then, I want to mix them all up.
So, three main stages. 1. Input 2. Remove doubles - tripples - ect.
and 3. Mix em up.
The input is pretty easy. I could use a for loop but then I would have
to have a set number of input characters, correct? I am using this
right now.....
char x = 'a';
int y = 0;
while ( a != '*' )
{
cin >> arrayname[y];
y++;
}
So they would input the characters until they were done and then add *
at the end. Then I can just discard the last entry into the array.
That will pull in my characters.
Now, no idea how I will remove like items. Maybe feed each element
into a new array and check for doubles as I go? Any good ideas here?
Then, how to mix them up.... I was thinking of using the srand and
rand to generate a random number based off an entered seed number and
grab that element number from the first array and insert it in order
in a new array.
So, how bad have I screwed up the logic on this one?