سؤال

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