[問題] 如何把111跟222改成YES跟NO
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
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章