3

バブル ソート アルゴリズムのコンパイルに問題があります。何が間違っているのかわかりません。誰かが私を助けてくれたら、とても感謝します。

これはコードです:

program bubble

   integer, dimension(6) :: vec 
     integer :: temp, bubble, lsup, j

      read *, vec !the user needs to put 6 values on the array
       lsup = 6 !lsup is the size of the array to be used

  do while (lsup > 1)
bubble = 0 !bubble in the greatest element out of order
      do j = 1, (lsup-1)
    if vet(j) > vet(j+1) then
    temp = vet(j)
    vet(j) = vet(j+1)
    vet(j+1) = temp
    bubble = j
      endif 
    enddo
    lsup = bubble   
enddo   
    print *, vet
end program

ありがとう!

4

1 に答える 1