LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2011, 12:25 PM   #1
Arcane
Member
 
Registered: May 2006
Location: Latvia, Europe
Distribution: random
Posts: 310

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Calculating combinations&variations in Pascal


I'm looking for some method in Turbo Pascal 7.0 or other similar tool like WiseCalculator to accomplish what i tried to show in this picture:
http://i53.tinypic.com/eur22s.jpg
However picture shows just very simple and basic version of idea and it only shows order of operations with first object A. Real challenge is if the boxes(named One, Two and Three) are more than 3 for example 10 and containing letters|numbers|symbols in one box also are 10 and then some code or program or function|formula should calculate every possible combination from those given letters|numbers|symbols in boxes and display as viewable list. Also contents and amount of boxes&contents are given either writing them in code file or program itself when it runs and asks for data in dialogue before it executes. I was thinking maybe do something with arrays but any other ideas would be nice.
 
Old 09-10-2011, 01:47 PM   #2
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Rep: Reputation: 22
Yes, take an array for each box and also an index for each array.
Then cascade the access of each array with its index in a for to do loop to generate all combinations or search.
If you have a max_entry variable for each arry you can represent a number for each compination and sign to a special compination:

curent_combination := curent_combination * max_entry_1 + index_1; {for each/all index(es) and its/their weight)
curent_combination := curent_combination * max_entry_2 + index_2;
...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Variations Based on Fedora? Novatian Fedora 3 12-23-2010 09:45 PM
Help Calculating page faults in Linux Kernel 2.6 & Adding external Load to a system umassd123 Linux - Kernel 1 12-11-2007 06:59 AM
LXer: Variations on a virtualization theme LXer Syndicated Linux News 0 03-26-2007 11:46 AM
Variations on derogatory names for Microsoft goofyheadedpunk General 3 04-06-2004 02:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration