dimanche 22 février 2015

c++ Do-While, Random Words From Array For String With No Repitition

What I want done is to have an array of words then a string is assigned a random word from the array but no string can have the same word. I tried this but when it runs, it will only do the do-while once then go onto the next do-while leaving duplicates. So what part of what I've written is incorrect and what can I do to fix it?



string1 = words[rand()%110];

do{
string2 = words[rand()%110];
}while (string == string1);

do{
string3 = words[rand()%110];
}while (string3 == string1 && string3 == string2);




Aucun commentaire:

Enregistrer un commentaire