Sep 3, 2013 at 10:23pm UTC
I have 208 string in my array and I'm trying to shuffle them all.
When I run the program, it shuffle only every first letter of each string, not the whole string. Just the first letter. How can I get it to shuffle the whole string.
Last edited on Sep 3, 2013 at 11:17pm UTC
Sep 3, 2013 at 10:37pm UTC
What you do is what you get.
Sep 3, 2013 at 10:41pm UTC
Do you know what I did wrong?
Sep 3, 2013 at 10:43pm UTC
Show me where do you shuffle the whole string.
Sep 3, 2013 at 10:45pm UTC
Right here:
1 2 3 4 5 6
int m = rand() % 104;
int n = rand() % 2;
char t = dest[i][j];
dest[i][j] = dest[m][n];
dest[m][n] = t;
Last edited on Sep 3, 2013 at 10:45pm UTC
Sep 3, 2013 at 10:47pm UTC
Where is there a string? Is for example t a string? Before speaking about strings you should at first understand what is the string.
Sep 3, 2013 at 10:49pm UTC
I guess char t should be char t[]
Sep 3, 2013 at 10:52pm UTC
And what about dest[i][j]? What is its type?
Sep 3, 2013 at 10:54pm UTC
dest[i][j] is where the strings are contained. A c string.
Last edited on Sep 3, 2013 at 10:55pm UTC
Sep 3, 2013 at 10:57pm UTC
No it is also only one character.