Heres the summary of my project. I am given 2 large .txt lists. The first is a list of 6 letter words. The second is a list of words that can be made from the words on the first list. The words in the second list have varying character lengths, n < 6.
-I've been able to store the both lists into arrays.
-I'm able to randomly generate a word from the first list.
-I've scrambled the word.
Now I have to cross-check that randomly chosen word with the second list to see how many words on the second list can be made from that chosen word.
That's where Im at. Here's my failed attempt:
string temp;
int x = 0; // this acts as a counter.
for (int s; s < wordlistcount2; s++)/* wordlistcount2 is the # of words in list2. */
{
wordlist[s] = temp; // stores the random word into a temporary string.
if (temp[0] == crword[0] || temp[0] == crword[1] || ...........
{
x = x++;
}
}
/*I compare temp[0] with crword[0].....[6]. Then I go to temp[1] and compare to crword[0]...[6]. Then temp[3]. And so on. Is there a shorter way to write this?*/
/* The idea is that if all the letters in a word match a letter in crword, then the if-statement is run, and x goes up by one. At the end, I should have a tally of how many words can be made.*/
/*But this only works if the words in list 2 are all the same length. And what if the word from list2 uses the same character twice? I don't know how to account for that =( */