• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing all string combinations  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to print all string combinations like
for ABC
I have to print like ...
ABC ---- total 6 combinations
ACB
BCA
BAC
CAB
CBA

If it is ABCD -- total 24 combinations

User may enter string length of n chars. It should print all combinatins

Thanks & Regards,
Kishore
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us what you have so far.
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But as a hint... I am assuming that you just learned "recursion" in your class.

This is a classic homework problem for recursion. It might be a good idea to apply what you learned to this assignment.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!