Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
6
Task/Nested-function/Fortran/nested-function-1.f
Normal file
6
Task/Nested-function/Fortran/nested-function-1.f
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
FUNCTION F(X)
|
||||
REAL X
|
||||
DIST(U,V,W) = X*SQRT(U**2 + V**2 + W**2) !The contained function.
|
||||
T = EXP(X)
|
||||
F = T + DIST(T,SIN(X),ATAN(X) + 7) !Invoked...
|
||||
END
|
||||
33
Task/Nested-function/Fortran/nested-function-2.f
Normal file
33
Task/Nested-function/Fortran/nested-function-2.f
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
SUBROUTINE POOBAH(TEXT,L,SEP) !I've got a little list!
|
||||
CHARACTER*(*) TEXT !The supplied scratchpad.
|
||||
INTEGER L !Its length.
|
||||
CHARACTER*(*) SEP !The separator to be used.
|
||||
INTEGER N !A counter.
|
||||
L = 0 !No text is in place.
|
||||
N = 0 !No items added.
|
||||
CALL ADDITEM("first") !Here we go.
|
||||
CALL ADDITEM("second")
|
||||
CALL ADDITEM("third")
|
||||
CONTAINS !Madly, defined after usage.
|
||||
SUBROUTINE ADDITEM(X) !A contained routine.
|
||||
CHARACTER*(*) X !The text of the item.
|
||||
N = N + 1 !Count another item in.
|
||||
TEXT(L + 1:L + 1) = CHAR(ICHAR("0") + N) !Place the single-digit number.
|
||||
L = L + 1 !Rather than mess with unknown-length numbers.
|
||||
LX = LEN(SEP) !Now for the separator.
|
||||
TEXT(L + 1:L + LX) = SEP !Placed.
|
||||
L = L + LX !Advance the finger.
|
||||
LX = LEN(X) !Trailing spaces will be included.
|
||||
TEXT(L + 1:L + LX) = X !Placed.
|
||||
L = L + LX !Advance the finger.
|
||||
L = L + 1 !Finally,
|
||||
TEXT(L:L) = CHAR(10) !Append an ASCII line feed. Starts a new line.
|
||||
END SUBROUTINE ADDITEM !That was bitty.
|
||||
END SUBROUTINE POOBAH !But only had to be written once.
|
||||
|
||||
PROGRAM POKE
|
||||
CHARACTER*666 TEXT !Surely sufficient.
|
||||
INTEGER L
|
||||
CALL POOBAH(TEXT,L,". ")
|
||||
WRITE (6,"(A)") TEXT(1:L)
|
||||
END
|
||||
23
Task/Nested-function/Fortran/nested-function-3.f
Normal file
23
Task/Nested-function/Fortran/nested-function-3.f
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
SUBROUTINE POOBAH(TEXT,N,SEP) !I've got a little list!
|
||||
CHARACTER*(*) TEXT(*) !The supplied scratchpad.
|
||||
INTEGER N !Entry count.
|
||||
CHARACTER*(*) SEP !The separator to be used.
|
||||
N = 0 !No items added.
|
||||
CALL ADDITEM("first") !Here we go.
|
||||
CALL ADDITEM("second")
|
||||
CALL ADDITEM("third")
|
||||
CONTAINS !Madly, defined after usage.
|
||||
SUBROUTINE ADDITEM(X) !A contained routine.
|
||||
CHARACTER*(*) X !The text of the item to add.
|
||||
N = N + 1 !Count another item in.
|
||||
WRITE (TEXT(N),1) N,SEP,X !Place the N'th text, suitably decorated..
|
||||
1 FORMAT (I1,2A) !Allowing only a single digit.
|
||||
END SUBROUTINE ADDITEM !That was simple.
|
||||
END SUBROUTINE POOBAH !Still worth a subroutine.
|
||||
|
||||
PROGRAM POKE
|
||||
CHARACTER*28 TEXT(9) !Surely sufficient.
|
||||
INTEGER N
|
||||
CALL POOBAH(TEXT,N,". ")
|
||||
WRITE (6,"(A)") (TEXT(I)(1:LEN_TRIM(TEXT(I))), I = 1,N)
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue