C C++/Matlab/Fortran 77Dictionary 335
write (6,*)"0toquit"
write (6,*) " ------------------------------"
read (5,*) nIf(n.eq.0) Go to 99write (6,101)
c--
q = 0.0D0
Do i=0,n-1
p = 2**i
q = q+p
write (6,100) i+1,p,q
End DoGo to 98! return to repeat
c--
99 Continue! done
100 Format (1x,i5,2(1x,i15))
101 Format (" bits",5x,"increment",5x,"largest integer")
Stop
EndAt the beginning of Section 4.6, we discussed the codeprj.ccthat com-
putes the inner product (projection) of two vectors. The equivalentFortran
77 program contained in the fileprj.f is:
Program prjDouble precision a(2), b(2), proda(1) = 0.1
a(2) = 0.2
b(1) = 2.1
b(2) = 3.1call prj (a, b, n, prod)write (6,*) " inner product: ", prodStop
Endc-------subroutine prj (a, b, n, prod)Double precision a(2), b(2), prj