link list string???

Question:
I have to create a link list of strings and then every single letter has to be separated into a link list for example.
if I enter two words like "good" and "bad" those have to be in a link list. I know how to do it, but then I have to make a link list every letter of one of the word for example
"good" has to be in a link list
g,o,o,d,
I need help to separate every letter of the word (string) then I know how to link listed them.
thanks for any help..
You know that you can access each element of the string using the [] operator.
I know that but I have this

1
2
3
4


	Contact* newWord = new Contact(&word[i]);


when i print

1
2
3
4
5
6
7
8

for(int i = 0; i < word.length(); i++)
{
cout << newWord->name;
   newWord->next = head;
        head = newWord;
}


the first print, prints the whole word then it prints the whole word minos the first character for example:
if the word is cat
when i = 0
it prints "cat"
when i = 1
it prints "at"
when i = 1
it prints "t"
Looks like its working fine. What is it that you actully want to do?
I have to permute a link list of a string let say for example if the word is "CAT"
I have to enter a string type "CAT"
then create a link list with the word "CAT" so every pointer will point to each letter "C" "A" "T" then permute them

CAT
ATC
ACT
CTA
TCA
CTA
TAC



It might be easier to use std::vector<char>

Then you can use any permutation alogorythm you want since std::vector operator[] allows indexed iteration.

Then after every three letters and their group of associated assorted asset states, You could output a space.
Last edited on
Topic archived. No new replies allowed.