View previous topic :: View next topic |
Author |
Message |
Laurent
Joined: 31 Jan 2011 Posts: 3
|
Posted: Mon Jan 31, 2011 8:02 pm Post subject: DO LOOP working....and not working!? |
|
|
I am completely new to Fortran and am learning using Silverfrost and the Plato IDE on my XP box.
Could somebody help me understand why the yn do loop in the lines below does not execute?
Thank you.
Code: | program TonMiles
implicit none
real Lh, TM, Wdp, Wdc, Whw, BF, MW
integer Unit_Transform
parameter (Unit_Transform = 10560000)
character(1) :: yn
! This program prompt user for Depth (in ft) and Mud Weight (in PPG) and returns TM for the
! Drilling String described in HW1 Prob 5.
interactive_loop: do !Keeps routine running if user chooses so with a "y" screen input
!or stops after a "n" screen user input
write (*,*) 'Enter Depth in ft:'
read (*,*) Lh
write (*,*) 'Enter Mud Weight in PPG:'
read (*,*) MW
BF = 1-MW/65.5
Wdp = 19.5*BF
Wdc = (96.2-19.5)*BF*660
Whw = (50-19.5)*BF*270
TM = (Lh*(93+Lh)*Wdp+4*Lh*(50000+Wdc/2+Whw/2))/Unit_Transform
write (*,*) 'TM = ', TM
yn = ' '
yn_loop: do
write(*,*) 'Perform one more Round Trip TM calculation? y[n]'
read(*,'(a1)') yn
if (yn=='y' .or. yn=='Y') exit yn_loop
if (yn=='n' .or. yn=='N' .or. yn==' ') exit interactive_loop
end do yn_loop
end do interactive_loop
end program TonMiles |
|
|
Back to top |
|
 |
Jeannot
Joined: 31 Jan 2011 Posts: 5 Location: Toulouse (France)
|
Posted: Wed Feb 02, 2011 3:46 pm Post subject: |
|
|
I have copied your code into Plato and runed it as well as Release Wind32 as Release net and it works perfectly ! |
|
Back to top |
|
 |
Laurent
Joined: 31 Jan 2011 Posts: 3
|
Posted: Wed Feb 02, 2011 5:20 pm Post subject: Re: |
|
|
Jeannot wrote: | I have copied your code into Plato and runed it as well as Release Wind32 as Release net and it works perfectly ! |
Merci Jeannot.
After your post, I tried to run the code again and the loop is now executing. The only thing I did in the mean time was to close Plato and reopen it. Not sure what happened. But it works now. Thanks for the help.
I am going through the tutorial that comes with Plato to learn Fortran, but couldn't find a tutorial for 95, only for 90. Would you know of a tutorial for 95, or are they enough similarities between 90 and 95 that learning with a 90 tutorial is OK?
I have not quite figured out how to run the debugger yet. I hope it will get clearer after a few more reads of the instructions...... |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Wed Feb 02, 2011 5:25 pm Post subject: |
|
|
There are very few differences between Fortran 90 and 95. |
|
Back to top |
|
 |
Laurent
Joined: 31 Jan 2011 Posts: 3
|
Posted: Wed Feb 02, 2011 7:21 pm Post subject: Re: |
|
|
PaulLaidler wrote: | There are very few differences between Fortran 90 and 95. |
Thank you. |
|
Back to top |
|
 |
|