program archivo
DESCRIPTION
fortranTRANSCRIPT
![Page 1: PROGRAM Archivo](https://reader035.vdocuments.us/reader035/viewer/2022072001/563db800550346aa9a8f9d70/html5/thumbnails/1.jpg)
PROGRAM archivo
implicit none
type datos
character(len=10)::nombre
character(len=14)::ap_paterno,ap_materno,distrito
character(len=10)::profesion
character(len=2)::sexo,est_civil
integer::edad
end type datos
integer::i
integer::conta1,conta2
type(datos),DIMENSION(10)::A
open(unit=3,file="PERSONA.DAT",status="OLD",position="rewind")
open(unit=5,file="EST_CIVIL.TXT",status="OLD")
print*,"NOMBRE AP_PATERNO AP_MATERNO &
& DISTRITO PROFESION SEXO EST.CIVIL EDAD"
do i=1,10
read(3,*) A(i)
print 10,A(i)
10 format(1x,A12,A14,A10,A14,A14,A4,A4,I5)
end do
close(3)
print*,"----------------------------------------------------------------"
!creando el achivo est-civil
!open(unit=3,file="PERSONAL.DAT",status="OLD")
do i=1,10
![Page 2: PROGRAM Archivo](https://reader035.vdocuments.us/reader035/viewer/2022072001/563db800550346aa9a8f9d70/html5/thumbnails/2.jpg)
if(A(i)%est_civil=="C") then
print*,A(i)
write(5,*) A(i)
end if
end do
close(5)
!visualizando la contidad de mujeres y varones
!open(unit=3,file="PERSONAL.DAT",status="OLD")
!read(3,*) A(i)
print*,"---------------------------------------------------------------"
conta1=0
conta2=0
do i=1,10
if(A(i)%sexo=="V")then
conta1=conta1+1
end if
if(A(i)%sexo=="F")then
conta2=conta2+1
end if
end do
print*,"la cantidad de varones son:",conta1
print*,"la cantida de mujeres son:",conta2
print*,"--------------------------------------------------------------"
!visualizando los datos de las personas mayores a 30 años
do i=1,10
if(A(i)%edad<30)then
![Page 3: PROGRAM Archivo](https://reader035.vdocuments.us/reader035/viewer/2022072001/563db800550346aa9a8f9d70/html5/thumbnails/3.jpg)
print*,A(i)
end if
end do
!close(3)
end program archivo