SORT/de

From MCS Wiki AVR
< SORT(Difference between revisions)
Jump to: navigation, search
(Created page with "= <span class="f_Header">Action</span> = Sorts an array in ascending order. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </span> ...")
 
(Example)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
Sorts an array in ascending order.
+
Sortiert ein Array in aufsteigender Reihenfolge.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Line 15: Line 15:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
{| width="488" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
Line 23: Line 23:
  
 
| valign="top" width="100%" style="width: 376px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 376px; border: 1px solid rgb(0, 0, 0);" |  
The first element of the array to sort.
+
Das erste Element des zu sortierenden Arrays.
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
Line 30: Line 30:
  
 
| valign="top" width="100%" style="width: 376px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 376px; border: 1px solid rgb(0, 0, 0);" |  
The number of elements to sort. This is an optional value. By default all elements will be sorted.
+
Anzahl der zu sortierenden Elemente. Optionaler Parameter. Standardmäßig werden alle Elemente sortiert.
  
 
|}
 
|}
Line 36: Line 36:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
Sorting is implemented for byte, word and integer arrays.
+
Sortieren funktioniert für Byte, Word und Integer Arrays.
  
The routines are located in mcs.lib.
+
Die Routinen sind in der mcs.lib.
  
 
&nbsp;
 
&nbsp;
Line 46: Line 46:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">See also</span> =
+
= <span class="f_Header">Siehe auch</span> =
  
 
<span style="font-family: Arial;">NONE</span>
 
<span style="font-family: Arial;">NONE</span>
Line 54: Line 54:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Example</span> =
+
= <span class="f_Header">Beispiel</span> =
  
 
<br/><source lang="bascomavr">
 
<br/><source lang="bascomavr">
Line 60: Line 60:
 
' SORT.BAS
 
' SORT.BAS
 
' (c) 1995-2011 , MCS Electronics
 
' (c) 1995-2011 , MCS Electronics
' This demo demonstrates the SORT statement. It will sort an array
+
' Dieses Programm demonstriert den SORT-Befehl. Ein Array wird sortiert.
' sort supports, byte, integer and word arrays at the first release
+
' SORT unterstützt Byte, Integer und Word Arrays.
 
'------------------------------------------------------------------------------
 
'------------------------------------------------------------------------------
 
$regfile = "m88def.dat"
 
$regfile = "m88def.dat"
Line 69: Line 69:
 
$framesize = 30
 
$framesize = 30
 
   
 
   
'Dim some arrays
+
'Arrays DIMensionieren:
 
Dim B(10) As Byte , I(10) As Integer , W(10) As Word
 
Dim B(10) As Byte , I(10) As Integer , W(10) As Word
 
Dim J As Byte
 
Dim J As Byte
 
   
 
   
'point to data
+
'Auf Datenbereich zeigen:
 
Restore Arraydata
 
Restore Arraydata
 
   
 
   
'read the data
+
'Daten lesen:
 
For J = 1 To 10
 
For J = 1 To 10
 
  Read B(j)
 
  Read B(j)
 
Next
 
Next
'read the words
+
'Words lesen_
 
For J = 1 To 10
 
For J = 1 To 10
 
  Read W(j)
 
  Read W(j)
 
Next
 
Next
'read the integers
+
'Integer lesen:
 
For J = 1 To 10
 
For J = 1 To 10
 
  Read I(j)
 
  Read I(j)
 
Next
 
Next
 
   
 
   
'now sort the arrays
+
'Arrays sortieren:
Sort B(1) , 10 ' 10 elements
+
Sort B(1) , 10 ' 10 Elemente
Sort W(1) ' all elements
+
Sort W(1) ' Alle Elemente
 
Sort I(1)
 
Sort I(1)
 
   
 
   
'and show the result
+
'Ergebnisse anzeigen:
 
For J = 1 To 10
 
For J = 1 To 10
 
  Print J ; " " ; B(j) ; " " ; W(j) ; " " ; I(j)
 
  Print J ; " " ; B(j) ; " " ; W(j) ; " " ; I(j)

Latest revision as of 23:13, 9 March 2013

Contents

Funktion

Sortiert ein Array in aufsteigender Reihenfolge.

 

 

Syntax

SORT array() [,elements]

 

 

Anmerkungen

array()

Das erste Element des zu sortierenden Arrays.

elements

Anzahl der zu sortierenden Elemente. Optionaler Parameter. Standardmäßig werden alle Elemente sortiert.

 

Sortieren funktioniert für Byte, Word und Integer Arrays.

Die Routinen sind in der mcs.lib.

 

 

 

Siehe auch

NONE

 

 

Beispiel


'-------------------------------------------------------------------------------
' SORT.BAS
' (c) 1995-2011 , MCS Electronics
' Dieses Programm demonstriert den SORT-Befehl. Ein Array wird sortiert.
' SORT unterstützt Byte, Integer und Word Arrays.
'------------------------------------------------------------------------------
$regfile = "m88def.dat"
$crystal = 8000000
$hwstack = 16
$swstack = 8
$framesize = 30
 
'Arrays DIMensionieren:
Dim B(10) As Byte , I(10) As Integer , W(10) As Word
Dim J As Byte
 
'Auf Datenbereich zeigen:
Restore Arraydata
 
'Daten lesen:
For J = 1 To 10
 Read B(j)
Next
'Words lesen_
For J = 1 To 10
 Read W(j)
Next
'Integer lesen:
For J = 1 To 10
 Read I(j)
Next
 
'Arrays sortieren:
Sort B(1) , 10 ' 10 Elemente
Sort W(1) ' Alle Elemente
Sort I(1)
 
'Ergebnisse anzeigen:
For J = 1 To 10
 Print J ; " " ; B(j) ; " " ; W(j) ; " " ; I(j)
Next
End
 
 
 
 
Arraydata:
Data 1 , 4 , 8 , 9 , 2 , 5 , 3 , 7 , 6 , 4
Data 1000% , 101% , 1% , 400% , 30000% , 20000% , 15000% , 0% , 999% , 111%
Data -1000% , 101% , -1% , 400% , 30000% , 2000% , -15000% , 0% , 999% , 111%

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language