would this code scramble a word? i keep getting errors and im not 100% sure why.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
unsigned int scramble(unsigned int word)
{
int l = word.length();
string scramble(l, 0);
//string scramble = "";
unsigned int hold = 0;
cout << "Please Wait ";
for (int i(0); i < l; i++)
{
scramble [i] = 0;
}
for (int q(1); q <= l; q++)
{
while (true)
{
srand((unsigned)time(NULL));
hold = (rand() % (l)) + 0;
if (scramble[hold] == 0)
{
scramble += scramble[hold];
scramble[hold] = 1;
cout << ".";
break;
}
}
}
cout << endl << scramble;
return word;
}
|
Last edited on
Are your words normally integers?