[問題] 如何把111跟222改成YES跟NO

看板Fortran作者 (卡比)時間15年前 (2009/02/27 14:27), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
module typedef type student integer :: Chinese, English, Math, Natural, Social integer :: total end type end module program ex0921 use typedef implicit none integer, parameter :: fileid=10 integer, parameter :: students=20 character(len=80) :: tempstr type(student) :: s(students) type(student) :: total integer i, num, error open(fileid, file="grades.txt",status="old", iostat=error) if ( error/=0 ) then write(*,*) "Open grades.txt fail." stop end if read(fileid, "(A80)") tempstr total=student(0,0,0,0,0,0) do i=1,students read(fileid,*) num, s(i)%Chinese, s(i)%English, & s(i)%Math, s(i)%Natural, s(i)%Social if (s(i)%Math >= 60 ) then s(i)%Total = 111 else if ( s(i)%Math < 60 ) then s(i)%Total = 222 end if end do write(*,"(6A10,A11)") "Num","Chinese","English","Math","Natural","Social","Math pass" do i=1,students write(*,"(3I9,3X,4I9)") i, s(i) end do stop end program -------------------------------------------------------------- 請問要如何改變才可以把111跟222改成YES跟NO? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.0.192.88
文章代碼(AID): #19fuVQEw (Fortran)
文章代碼(AID): #19fuVQEw (Fortran)