can i use a stringstream in this problem?

I'm beginning a problem in which I need to take each individual letter in a single word and output one word that is associated to each letter. For example, if I put in the word "bad" my program would output something like "barnus attack day". Now this is a homework problem and I already google searched it and found an answer, but I am not a cheater and I want my own solution.

So I have been browsing high and low to find some kind of creative solution that does not include an array and I think I've decided to try to use a stringstream. My question is:

If I want to have a user input one single word
Can I then make a stringstream that will operate on each letter in the word
And output whatever I'd like it to output?

A stringstream might be more than enough, a std::string would suffice. But still:
1
2
3
4
    istringstream ss("ABC123");
    char c;
    while (ss >> c)
        cout << '"' << c << "\"    ";  

Output:
"A"    "B"    "C"    "1"    "2"    "3"
Topic archived. No new replies allowed.