主题:[讨论]菜鸟问题,但是急需高手们解答!
求高手帮助在原有基础上帮我改改,谢谢!!! module stu
type student
integer :: num,hight,weigh
integer :: chinese,math,english,ocean,total,aver
integer :: sum1,sum2
real :: aver1,aver2
character(len=10) :: sex
end type
end module
subroutine infor(n)
use stu
implicit none
integer i,j,k,m,n
type(student) :: s(n)
type(student) :: total,aver
type(student) :: temp
type(student) :: sex
character(len=9) :: sexs
real,dimension(2) :: t=0,sum1=0,sum2=0,aver1=0,aver2=0,variance=0
real,dimension(2) :: r
open(1,file='score.txt')
open(2,file='score1.txt')
open(3,file='score2.txt')
open(4,file='score3.txt')
write(2,'(10a9)') 'num', 'sex','hight','weigh','chinese','math','english','ocean','total','aver'
write(3,'(7a9)') 'num', 'chinese','math','english','ocean','total','aver'
write(4,'(10a9)') 'num', 'sex','hight','weigh','chinese','math','english','ocean','total','aver'
do i=1,20
read(1,*) s(i)%num,s(i)%sex,s(i)%hight,s(i)%weigh,s(i)%chinese,s(i)%math,s(i)%english,s(i)%ocean
s(i)%total=s(i)%chinese+s(i)%math+s(i)%english+s(i)%ocean
s(i)%aver=s(i)%total/4.0
write(2,'(i9,a9,8i9)') s(i)
sum1=sum1+s(i)%hight
sum2=sum2+s(i)%weigh
aver1=sum1/20
aver2=sum2/20
end do
write(*,*)'please input the sex of the student you want to check:'
read(*,*) sexs
select case(sexs)
case('female')
do k=1,7
do j=k+1,8
if(s(k)%total<=s(j)%total)then
temp=s(k)
s(k)=s(j)
s(j)=temp
end if
end do
end do
do m=1,8
write(3,'(9i9)') s(m)
end do
case default
end select
do i=1,20
t=t+(aver1-s(i)%hight)*(aver2-s(i)%weigh)
variance(1)=sqrt(variance(1)+(aver1(1)-s(i)%hight)**2)
variance(2)=sqrt(variance(2)+(aver2(2)-s(i)%weigh)**2)
end do
r=t/(variance(1)*variance(2))
write(4,"(8f9.2)") "r=",r
end subroutine
program main
implicit none
integer :: n
call subroutine
end
--------------------Configuration: exam0001 - Win32 Debug--------------------
Linking...
exam0001.obj : error LNK2001: unresolved external symbol _SUBROUTINE@0
Debug/exam0001.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
exam0001.exe - 2 error(s), 0 warning(s)
type student
integer :: num,hight,weigh
integer :: chinese,math,english,ocean,total,aver
integer :: sum1,sum2
real :: aver1,aver2
character(len=10) :: sex
end type
end module
subroutine infor(n)
use stu
implicit none
integer i,j,k,m,n
type(student) :: s(n)
type(student) :: total,aver
type(student) :: temp
type(student) :: sex
character(len=9) :: sexs
real,dimension(2) :: t=0,sum1=0,sum2=0,aver1=0,aver2=0,variance=0
real,dimension(2) :: r
open(1,file='score.txt')
open(2,file='score1.txt')
open(3,file='score2.txt')
open(4,file='score3.txt')
write(2,'(10a9)') 'num', 'sex','hight','weigh','chinese','math','english','ocean','total','aver'
write(3,'(7a9)') 'num', 'chinese','math','english','ocean','total','aver'
write(4,'(10a9)') 'num', 'sex','hight','weigh','chinese','math','english','ocean','total','aver'
do i=1,20
read(1,*) s(i)%num,s(i)%sex,s(i)%hight,s(i)%weigh,s(i)%chinese,s(i)%math,s(i)%english,s(i)%ocean
s(i)%total=s(i)%chinese+s(i)%math+s(i)%english+s(i)%ocean
s(i)%aver=s(i)%total/4.0
write(2,'(i9,a9,8i9)') s(i)
sum1=sum1+s(i)%hight
sum2=sum2+s(i)%weigh
aver1=sum1/20
aver2=sum2/20
end do
write(*,*)'please input the sex of the student you want to check:'
read(*,*) sexs
select case(sexs)
case('female')
do k=1,7
do j=k+1,8
if(s(k)%total<=s(j)%total)then
temp=s(k)
s(k)=s(j)
s(j)=temp
end if
end do
end do
do m=1,8
write(3,'(9i9)') s(m)
end do
case default
end select
do i=1,20
t=t+(aver1-s(i)%hight)*(aver2-s(i)%weigh)
variance(1)=sqrt(variance(1)+(aver1(1)-s(i)%hight)**2)
variance(2)=sqrt(variance(2)+(aver2(2)-s(i)%weigh)**2)
end do
r=t/(variance(1)*variance(2))
write(4,"(8f9.2)") "r=",r
end subroutine
program main
implicit none
integer :: n
call subroutine
end
--------------------Configuration: exam0001 - Win32 Debug--------------------
Linking...
exam0001.obj : error LNK2001: unresolved external symbol _SUBROUTINE@0
Debug/exam0001.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
exam0001.exe - 2 error(s), 0 warning(s)