用易语言写一个冒泡排序
时间: 2023-05-15 12:04:40 浏览: 123
以下是用易语言写的冒泡排序代码:
```
Var
i, j, temp: int;
arr: array[1..10] of int = (5, 2, 8, 3, 1, 9, 4, 6, 7, 10);
Begin
For i := 1 to 9 do
For j := 1 to 10 - i do
If arr[j] > arr[j + 1] Then
Begin
temp := arr[j];
arr[j] := arr[j + 1];
arr[j + 1] := temp;
End;
For i := 1 to 10 do
WriteLn(arr[i]);
End.
```
希望能对您有所帮助!
阅读全文