<span class="hljs-keyword">CHARACTER</span>(<span class="hljs-number">10</span>) <span class="hljs-keyword">NAME</span>(<span class="hljs-number">3</span>)
<span class="hljs-keyword">CHARACTER</span>(<span class="hljs-number">5</span>) <span class="hljs-keyword">NUMBER</span>(<span class="hljs-number">3</span>)
<span class="hljs-keyword">INTEGER</span> G1(<span class="hljs-number">3</span>),G2(<span class="hljs-number">3</span>)
OPEN (<span class="hljs-number">10</span>,<span class="hljs-keyword">FILE</span>=<span class="hljs-string">'ccccc.dat'</span>,<span class="hljs-keyword">ACCESS</span>=<span class="hljs-string">'DIRECT'</span>,<span class="hljs-keyword">RECL</span>=<span class="hljs-number">25</span>)
<span class="hljs-keyword">DO</span> I=<span class="hljs-number">1</span>,<span class="hljs-number">3</span>
READ(<span class="hljs-number">10</span>) <span class="hljs-number">100</span>,<span class="hljs-keyword">NAME</span>(I),<span class="hljs-keyword">NUMBER</span>(I),G1(I),G2(I)
<span class="hljs-keyword">ENDDO</span>
<span class="hljs-number">100</span> <span class="hljs-keyword">FORMAT</span>(A10,A5,<span class="hljs-number">2</span>I5)
<span class="hljs-keyword">END</span>
写的代码如上
<span class="hljs-attribute">xuesheng0100001</span> <span class="hljs-number">89</span> <span class="hljs-number">89</span>xuesheng0300003 <span class="hljs-number">89</span> <span class="hljs-number">89</span>xuesheng0200002 <span class="hljs-number">89</span> <span class="hljs-number">89</span>
这是ccccc.dat文件的内容
--------------------Configuration: B - Win32 Release--------------------
Compiling Fortran...
F:\school code fortran\NEW\B\b1.f90
F:\school code fortran\NEW\B\b1.f90(6) : Error: Constants and expressions are invalid in read-only I/O lists. [100]
<span class="hljs-section">READ(10) 100,NAME(I),NUMBER(I),G1(I),G2(I)
---------^</span>
Error executing df.exe.
b1.obj - 1 error(s), 0 warning(s)
报错,如果把100去掉或者放到括号里面再执行小黑框会这么显示
forrtl: severe (<span class="hljs-number">259</span>): sequential-<span class="hljs-keyword">access</span> I/O <span class="hljs-keyword">to</span> unit <span class="hljs-keyword">open</span> <span class="hljs-keyword">for</span> direct <span class="hljs-keyword">access</span>, unit <span class="hljs-number">10</span>, file F:\school code fortran\<span class="hljs-built_in">NEW</span>\B\ccccc.dat
Image PC <span class="hljs-keyword">Routine</span> <span class="hljs-type">Line</span> Source
B.exe <span class="hljs-number">00406579</span> <span class="hljs-type">Unknown</span> <span class="hljs-type">Unknown</span> <span class="hljs-type">Unknown</span>
Press <span class="hljs-keyword">any</span> key <span class="hljs-keyword">to</span> <span class="hljs-keyword">continue</span>
麻烦了,第一次学编程语言,还请大神们指点指点
另外帮忙看看这道题,哈哈哈,做了几个小时了,还没解决,实在搞不下去了,大神不用给我弄50个学生,搞个三四个意思到了就行😁