I need to generate a sound in fortran when my run ends. I need something similar to "\a" or Beep(,) that are used in c++.

有帮助吗?

解决方案

Try adding the following at the end of your program

print *, char(7)

其他提示

If you want to be a little creative you can end your program with a music file. In most c:/windows/media folders you can find a number of .wav files. In this case I copied the tada.wav file over to the location of my executable so it can play the tada.wav file in the command prompt when the program ends.

If you use Intel Fortran then this implementation shall work:

  program zsound
  use ifport
  implicit none
  integer i
  character(100) :: musicfile

  musicfile = "tada.wav"


  !  Your Program goes here...


  ! CALL EXECUTE_COMMAND_LINE(musicfile)
  i = system(musicfile)

  end
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top