read(unit,fmt),variable_listprint(fmt),variable_listwrite(unit,fmt),variable_list unit表示输出单元,fmt是格式标识符。 与write语句相比,print语句少了一个unit,即print语句无法指定输出单元。因此,使用print语句只能将信息输出到屏幕。 一般来说,格式化输入read和格式化输出print用的比较少,感兴趣的同学可以自行查...
andoutput(area)tothescreen.write(*,'(1x,a7,f6.2,5x,a7,f6.2,5x,a5,f6.2)')&!"&"表示续行。这里还显示了格式化输出'radius=',radius,'height=',height,'area=',areayn=''yn_loop:do!内嵌的另一个do循环write(*,*)'Performanothercalculation?y[n]'read(*,'(a1)')ynif(yn=='y'.or.yn...
cycle 相当于C里的continueend if! 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)')&!"&"表示续行。
! 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(*...
!andoutput (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(*,'(a1...
! 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循环
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)')...
! 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)') & ...
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 calculation? y[n]read(*,(a1)) ynif (yn==y .or...
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:...