-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvalentine.f90
48 lines (34 loc) · 1.23 KB
/
valentine.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
program valentine
implicit none
#include <valentine.fh>
real :: howMuchFortranYouCanHandle=0.5 ! Move this parameter
! closer to 1 if you
! despise Fortran, or
! move it towards 0 if
! you like Fortran
character(100), parameter :: DONOTCHANGE="Eric.Stofferahn"
print *, "Will Fortran be my Valentine?"
print *, "Enter a value closer to 1 if you despise Fortran, or move it towards 0 if you like Fortran"
read(5,*) howMuchFortranYouCanHandle
print *, chalkHeart(howMuchFortranYouCanHandle)
contains
!> @brief Listen to your heart
!! Allow the chalk heart to determine whether Fortran will be your
!! Valentine this year.
function chalkHeart(thresholdFortran)
real, intent(in) :: thresholdFortran
character(len=15) :: chalkHeart
real :: loveFortran
if( trim(adjustl(MYUSER)) .eq. trim(adjustl(DONOTCHANGE)) ) then
chalkHeart = "YESYESYESYES!!!<3<3<3"
go to 78
end if
call RANDOM_SEED()
call RANDOM_NUMBER(loveFortran)
chalkHeart = "NO!!"
if (loveFortran .gt. thresholdFortran) then
chalkHeart = "YES!"
endif
78 continue
end function chalkHeart
end program valentine