read(unit,fmt),variable_listprint(fmt),variable_listwrite(unit,fmt),variable_list unit表示输出单元,fmt是格式标识符。 与write语句相比,print语句少了一个unit,即print语句无法指定输出单元。因此,使用print语句只能将信息输出到屏幕。 一般来说,格式化输入read和格式化输出print用的比较少,感兴趣的同学可以自行查...
cycle 相当于C里的continueendif! Compute area. The ** means "raise to a power."area =2* pi * (radius**2+ radius*height)!指数运算比C方便! Write the input variables (radius, height) and output (area) to the screen.write(*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)') &'radius=',...
print *,n prints data to the screen. Use the command write to write to a printer or a file. Here the * indicates default formatting.DECLARATIONSIn Fortran, Variables and functions MUST be declared. real :: (numbers with decimals: 3.5, -2., .088) integer :: (numbers without decimals:...
Write the input variables(radius,height)and output(area)to the screen.write(*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)')&!"&"表示续行。这里还显示了格式化输出'radiu 10、s=',radius,'height=',height,'area=',area yn=''yn_loop:do!内嵌的另一个do循环write(*,*)'Perform another ...
The following should print out to the screen: 显示下行则测试成功 SUCCESS test 1 fortran only fixed format Test #2: Free Format Fortran: TEST_2_fortran_only_free.f90测试2Type the following in the command line:输入如下命令 gfortran TEST_2_fortran_only_free.f90 ...
! and output (area) to the screen. write (*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)') & !"&"表示续行。这里还显示了格式化输出 'radius=',radius,'height=',height,'area=',area yn = ' ' yn_loop: do!内嵌的另一个do循环 write(*,*) 'Perform another calculation? y[n]' read(*...
! Compute area. The ** means "raise to a power." area = 2 * pi * (radius**2 + radius*height) ! 指数运算比C方便 ! Write the input variables (radius, height) ! and output (area) to the screen. write (*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)') & ...
Write the input variables (radius, height) and output (area) to the screen.write(*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)')&!"&"表示续行。这里还显示了格式化输出'radius=',radius,'height=',height,'area=',areayn=' 'yn_loop:do!内嵌的另一个do循环write(*,*)'Perform another calcula...
AREA = 2 *PI * (RADIUS**2 + RADIUS*HEIGHT) , 指数运算比 C 方便 Write the input variables (RADIUS, HEIGHT) and output (AREA) to the screen 叩TE (*,( 1X,A7,F6.2,5X,A7,F6.2,5X ,A5,F6.2)) I 表续行;格式化输出 RADIUS=,RADIUS ,HEIGHT= ,HEIGHT,AREA= ,AREA YN = YN_LOOP DO...
! and output (area) to the screen. write (*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)') & !"&"表示续行。这里 !还显示了格式化输出 'radius=',radius,'height=',height,'area=',area yn = ' ' yn_loop: do !内嵌的另一个do循环 write(*,*) 'Perform another calculation? y[n]' rea...