Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 574765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:51:59+00:00 2026-05-13T13:51:59+00:00

I have pascal code (programming language actually doesn’t mean anything): box[1] := 14; box[2]

  • 0

I have pascal code (programming language actually doesn’t mean anything):

box[1] := 14;
box[2] := 2;
box[3] := 4;
box[4] := 5;
box[5] := 6;
box[6] := 8;

I want to get all possibilities. For instance, box[1] = box[6], then box[6] = box[1]. Yes, I can write it by my hand, but I guess I can make it more clever, by loop. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:51:59+00:00Added an answer on May 13, 2026 at 1:51 pm

    I have taken the first permutation algorithm I found in wikipedia and implemented it in Delphi (2009); I hope that is what you are looking for:

    type
      TIntegerArray = array of Integer;
    
    procedure Permutation(K: Integer; var A: TIntegerArray);
    var
      I, J: Integer;
      Tmp: Integer;
    
    begin
      for I:= 2 to Length(A) do begin
        J:= K mod I;
        Tmp:= A[J];
        A[J]:= A[I - 1];
        A[I - 1]:= Tmp;
        K:= K div I;
       end;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      K, I: Integer;
      A: TIntegerArray;
      S: string;
    
    begin
      Memo1.Lines.Clear;
      for K:= 0 to 719 do begin
        A:= TIntegerArray.Create(14, 2, 4, 5, 6, 8);
        Permutation(K, A);
        S:= '';
        for I:= 0 to Length(A) - 1 do
          S:= S + Format('%3.d ', [A[I]]);
        Memo1.Lines.Add(S);
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want my own pascal code to be executed it also have some uses
We have some ancient Delphi code (might have even originated as Turbo Pascal code)
I have a pascal code that encrypts files using RIJNDAEL / sha 512 and
i need a tool that can convert c/c++ code to delphi(object pascal) code, have
I want to get a random number in pascal from between a range. Basically
I have a pascal code file and need to parse it (using c#) and
I have written a recursive Tree Function in pascal ( or delphi ) but
I have written a program using Free Pascal and the Lazarus IDE. In brief,
I have a very simple question. Look t my code which is written in
OK, I have some C++ code in a header that is declared like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.