{"id":59,"date":"2017-09-11T13:25:51","date_gmt":"2017-09-11T16:25:51","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=59"},"modified":"2017-09-11T13:25:51","modified_gmt":"2017-09-11T16:25:51","slug":"array2se-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/array2se-f\/","title":{"rendered":"array2se.f"},"content":{"rendered":"<pre>PROGRAM ARRAY2SE\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 array2.f\r\nc\r\nc    John Mahaffy   12\/27\/94\r\nc\r\n      IMPLICIT NONE\r\nc\r\n      INTEGER ND\r\n      PARAMETER (ND=10)\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   The use of * below doesn't cut it with Fortran 90 structures in\r\nC   their simplest forms.  It needs to know the array size.\r\nC\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      C=A+B\r\n      CMAX=MAXVAL(C)\r\n      CMIN=MINVAL(C)\r\n      CSUM=SUM(C)\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 = ',1p,\/,(8E10.2))\r\nC\r\n      RETURN\r\n      END<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PROGRAM ARRAY2SE 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 array2.f c c John Mahaffy 12\/27\/94 c IMPLICIT NONE c INTEGER ND PARAMETER (ND=10) 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-59","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/59","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=59"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/59\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/59\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}