
Year 2000 Examples
Example 1: Fortran Program samp1.f - 2-digit Year Processing
character*6 date1,date2
character *20 name1,name2
common name1,name2,m1,m2,d1,d2,y1,y2
integer m1,m2,d1,d2,y1,y2
read(*,'(a)')name1
read (*,'(a)')date1
read(*,'(a)')name2
read (*,'(a)')date2
read(date1,'(3i2)')m1,d1,y1
read(date2,'(3i2)')m2,d2,y2
if(y1.eq.y2.and.m1.eq.m2.and.d1.eq.d2)then
print *, name1,' with birthdate: ',m1,'/',d1,'/',y1
print *
print *, 'is the same age as'
print *
print *, name2,' with birthdate: ',m2,'/',d2,'/',y2
else if(y1.eq.y2.and.m1.eq.m2)then
call compare(d1,d2)
else if(y1.eq.y2) then
call compare(m1,m2)
else
call compare(y1,y2)
endif
end
subroutine compare(ix1,ix2)
character *20 name1,name2
integer m1,m2,d1,d2,y1,y2
common name1,name2,m1,m2,d1,d2,y1,y2
if(ix1.gt.ix2) then
print *, name1,' with birthdate: ',m1,'/',d1,'/',y1
print *
print *, 'is younger than'
print *
print *, name2,' with birthdate: ',m2,'/',d2,'/',y2
else
print *, name2,' with birthdate: ',m2,'/',d2,'/',y2
print *
print *, 'is younger than'
print *
print *, name1,' with birthdate: ',m1,'/',d1,'/',y1
endif
end
Example 2: Fortran Program samp1fixedw.f - 2-digit Year Processing Using a Fixed Window with Pivot Year 1960
We modify the program, samp1.f, to include fixed window logic,
producing samp1fixedw.f
Example 3: Fortran Program samp1slidew.f - 2-digit Year Processing Using a Sliding Window
This section for a sliding window is not operational. Work in progress.
We modify the program, samp1.f, to include sliding window logic,
producing
samp1slidew.f
Example 4: Fortran Program samp1compress.f - 2-digit Year Processing Using a Hexidecimal Representation
This section that uses compression is not operational. Work in progress.
We modify the program, samp1.f, to include sliding window logic,
producing
samp1compress.f
Example 5: Fortran Program samp1expand.f - 4-digit Year Processing
We modify the program, samp1.f, using 4 digit year variables in place of 2-digit
years producing samp1expand.f
Example 6: Fortran Program samp2.f - 2-digit Year Processing with Input from a File
We modify program samp1.f to produce the program samp2.f
.
Program samp2.f reads input from file file samp2in
which contains the lines:
Bob Barker
011077
Tom Tyler
102088
Example 7: Fortran Program samp2expand.f (input from a file)
This program is in process