开眼镜店怎么样:怎样用fortran写一个bubble sort的程序

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 05:18:34
请教一下,谁知道怎样用fortran写一个bubble sort的程序,不用很复杂,只要是bubble sort就行。谢了,我会加分的,如果答案好的话。
一定要用fortran

为什么用fortran阿?JAVA的
public void bubbleSort(int a[]) { //数组的冒泡排序
int n = a.length;
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - 1; j++) {
if (a[j] > a[j + 1]) {
int temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
}