DO WHILE(逻辑表达式)...END DO 在新程序中不要使用DO WHILE循环,而使用更一般的当循环。3.1.3 ...
在Fortran中,循环结构主要通过do循环语句来实现。do循环语句有三种常见形式:do循环、do while循环和do until循环。这些循环结构都可以用来控制loop_time,即循环执行的次数。 1. do循环 do循环是Fortran中最常见的循环结构,用于指定循环次数。其语法形式如下: ```fortran do i = start, end, step !循环执行的语句...
DO / DO WHILE Block IF / ELSE IF ELSE END IF END Logical IF If s is not specified, the DO WHILE loop must end with an END DO statement. DO WHILE Loop RangeThe range of a DO WHILE loop consists of all the executable statements that appear following the DO WHILE statement, ...
implicitnoneinteger:: ierrcharacter:: ynreal:: radius, height, areareal,parameter:: pi =3.1415926536!这是常量的声明方法interactive_loop:do!do循环,Fortran中的循环可以加标签,如d前面的!interactive_loop就是标签! Prompt the user for radius and height and read them.write(*,*)'Enter radius and heig...
在linux下的运行此程序时,只要在 do while 循环中加入一个输出语句 如 do while(flag)if(newloop==...
循环语句是计算科学中最最最常用的语句。首先介绍do语句和do while语句的用法,它们的结构为, 它们经常配合 if 语句完成循环的任务, 输出结果: 和if 类似,do 之前也可以命名,方便在多层嵌套循环中离开某个循环。比如,有3层循环,从外到内分别为loop1, loop2, loop3,当 loop3 中满足某个条件时,代码需要离开loo...
If the value of the expression is true, the statements in the range of the DO WHILE loop are executed. If the value of the expression is false, control is transferred to the statement following the DO WHILE loop. Terminal StatementIf...
首先,我的英语不好。对不起。 就我所知道。Fortran地址是主要列。我的旧Fortran代码在很长一段时间内都没有优化。我尝试更改我的Fortran90代码索引以获得更快的速度。一个代码几乎是三维矩阵。(i,j,k)和几乎Do-loop大约是i和j。i和j的大小大约是2000~3000,k正好是2,它意味着x,y。我的旧...
Do循环块是Fortran语言中的一种循环结构,用于重复执行一段代码。 概念: Do循环块是一种控制结构,用于在程序中重复执行一段代码。它由一个循环控制变量、起始值、终止值和步长组成。循环控制变量在每次循环迭代时递增或递减,直到达到终止值为止。 分类: Fortran 77中的Do循环块有两种类型:Do循环和Do While循环。Do...
name为循环的名字,可省略;Label为循环终端语句的标号,可省略,如果使用,则do后面的标号必须和循环终端语句的标号一致;loop_control循环的控制部分,有三种选择,(1)i=e1,e2[,e3],(2)while(e),(3)省略 3.2DO循环结构 [name:]do[label[,]][loop_control]block[label]term_stmt[name]...