We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Say I have the set 0-3 what's an effecient way to

go through every combination ie(0,0,0,0),(0,0,0,1), .... ,(3,3,3,3)

But in a general way such that it's always 0-3, but it may be 4 digits or it may be 5 digits or any other number?

If I know the length I could do nested for loops, but since I don't...is there an effecient and general way to do it?

2
Contributors
2
Replies
24 Minutes
Discussion Span
3 Months Ago
Last Updated
5
Views
Question
Answered
Forte1292
Newbie Poster
22 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

It is basically the same as counting in base 4.

mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 280
Skill Endorsements: 36
Question Answered as of 3 Months Ago by mvmalderen

Thanks!

Forte1292
Newbie Poster
22 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0629 seconds using 2.75MB