{"id":54,"date":"2017-09-11T13:13:15","date_gmt":"2017-09-11T16:13:15","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=54"},"modified":"2017-09-11T13:13:15","modified_gmt":"2017-09-11T16:13:15","slug":"array1s-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/array1s-f\/","title":{"rendered":"array1s.f"},"content":{"rendered":"<pre>PROGRAM ARRAY1S\r\nc\r\nc    Since you will be pushing your real work out of the main program\r\nc    into Subprograms, you need to know about passing arrays in and out\r\nc    of Subroutines.  Here is a rewrite of array1.f\r\nc\r\nc    John Mahaffy   12\/27\/94\r\nc\r\n      IMPLICIT NONE\r\n      INTEGER ND\r\n      PARAMETER (ND=10)\r\nc\r\n      REAL A(ND),B(ND),C(ND)\r\n      REAL CSUM,CMAX,CMIN,AVERAGE\r\nc\r\n      DATA  A\/1.,2.,3.,4.,5.,6.,7.,8.,9.,10.\/,B\/3*1.,4*2.,3*3.\/\r\nc\r\nc\r\n      CALL CPROPS(A,B,C,ND,AVERAGE,CMAX,CMIN)\r\n      CALL WRITEC(C,ND,AVERAGE,CMAX,CMIN)\r\n      STOP\r\n      END\r\n      SUBROUTINE CPROPS( A, B, C, N , CAVG, CMAX, CMIN)\r\nC\r\nC   A common practice in Fortran 77 programs is to use a * in the dimension\r\nC   specification.  You are saying \"trust me, I know what I'm doing. All\r\nC   you need to know is that its an array\"\r\nC\r\n      REAL A(*),B(*),C(*)\r\n      REAL CSUM,CMAX,CMIN,CAVG\r\n      INTEGER I,N\r\nc\r\nc     Begin Executable Statements\r\nc\r\n      CSUM=0.\r\n      CMAX=-1.E38\r\n      CMIN=1.E38\r\n      DO 100 I=1,N\r\n         C(I)=A(I)+B(I)\r\n         CMAX=MAX(C(I),CMAX)\r\n         CMIN=MIN(C(I),CMIN)\r\n 100     CSUM=CSUM+C(I)\r\nC\r\n      CAVG=CSUM\/N\r\n      RETURN\r\n      END\r\n      SUBROUTINE WRITEC( C, N, CAVG, CMAX, CMIN)\r\nC\r\nC   A common practice in Fortran 77 programs is to use a * in the dimension\r\nC   specification.  You are saying \"trust me, I know what I'm doing. All\r\nC   you need to know is that its an array\"\r\nC\r\n      REAL C(*)\r\n      REAL CMAX,CMIN,CAVG\r\n      INTEGER J,N\r\nC\r\nc    The next write statement illustrates use of * for the unit number.\r\nc    It represents the default unit, which is the terminal.\r\nc\r\n      WRITE(*,*) ' RESULTS FOR FULL C ARRAY'\r\nc\r\nc    The format associated with the following write spreads the output\r\nc    of the three values (AVERAGE, CMIN, and CMAX) over 3 output lines.\r\nc\r\n      WRITE(6,2000)CAVG,CMIN,CMAX\r\n 2000 FORMAT(' AVERAGE OF ALL ELEMENTS IN C = ', F8.3,\/,\r\n     &amp;       ' MINIMUM OF ALL ELEMENTS IN C = ', F8.3,\/,\r\n     &amp;       ' MAXIMUM OF ALL ELEMENTS IN C = ', F8.3)\r\nc\r\n      WRITE(6,2001) (C(J),J=1,N)\r\n 2001 FORMAT(' C = ',\/,(8E10.2))\r\nC\r\n      RETURN\r\n      END<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PROGRAM ARRAY1S c c Since you will be pushing your real work out of the main program c into Subprograms, you need to know about passing arrays in and out c of Subroutines. Here is a rewrite of array1.f c c John Mahaffy 12\/27\/94 c IMPLICIT NONE INTEGER ND PARAMETER (ND=10) c REAL A(ND),B(ND),C(ND) REAL [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-54","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/54\/revisions"}],"predecessor-version":[{"id":55,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/54\/revisions\/55"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}