Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
22
Task/Sort-an-integer-array/COBOL/sort-an-integer-array.cobol
Normal file
22
Task/Sort-an-integer-array/COBOL/sort-an-integer-array.cobol
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
PROGRAM-ID. sort-ints.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 array-area VALUE "54321".
|
||||
03 array PIC 9 OCCURS 5 TIMES.
|
||||
01 i PIC 9.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
main-line.
|
||||
PERFORM display-array
|
||||
SORT array ASCENDING array
|
||||
PERFORM display-array
|
||||
|
||||
GOBACK
|
||||
.
|
||||
display-array.
|
||||
PERFORM VARYING i FROM 1 BY 1 UNTIL 5 < i
|
||||
DISPLAY array (i) " " NO ADVANCING
|
||||
END-PERFORM
|
||||
DISPLAY SPACE
|
||||
.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using System.Console;
|
||||
|
||||
module IntSort
|
||||
{
|
||||
Main() : void
|
||||
{
|
||||
def nums = [1, 5, 3, 7, 2, 8, 3, 9];
|
||||
def sorted = nums.Sort((x, y) => x.CompareTo(y));
|
||||
|
||||
WriteLine(nums);
|
||||
WriteLine(sorted);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import algorithm
|
||||
|
||||
var a: array[0..8,int] = [2,3,5,8,4,1,6,9,7]
|
||||
a.sort(system.cmp[int], Ascending)
|
||||
for x in a:
|
||||
echo(x)
|
||||
Loading…
Add table
Add a link
Reference in a new issue