random string

somebody can help me to make program like this ?

Input :
HAI
BKA
ADA
Output :
AHI, AIH, HAI, HIA, IAH, IHA
ABK, AKB, BAK, BKA, KAB, KBA
AAD, ADA, AAD, ADA, DAA, DAA

using recursion data structure
Last edited on
Show your attempt and people might.
1. You want to read each word separately.
http://www.cplusplus.com/doc/tutorial/basic_io/
http://www.cplusplus.com/reference/string/string/operator%3E%3E/

2. You want to sort characters in a word. This gets you the first word of each output line.
http://www.cplusplus.com/reference/algorithm/sort/

3. You want to shuffle the characters some more.
http://www.cplusplus.com/reference/algorithm/next_permutation/

You will need loops too.
http://www.cplusplus.com/doc/tutorial/control/


EDIT: A recursion? A loop can be converted into recursion. However, I guess you know better what "recursion data structure" means.
Topic archived. No new replies allowed.