Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

column reading in fortran

Status
Not open for further replies.

moldynamics

Technical User
Aug 14, 2012
1
GB
Dear forumers,

I am not an experienced programmer, so please bear with me :) I want to look at some data that I obtained and need to do the following, in pseudocode:

read x(k) list


do k=1 until end
if x(k+1) less than -10 !do nothing
end if
if x(k+1) greater than -10 then
x(k+2) greater than -10 and x(k+3) greater than -10
then
A=A+1
end if
LABEL A: do i=k till N
if x(i) greater than +10
then B=B+1
end if
go to A
end do

so basically, I need to look at values and check initially if the value is less than or greater than -10; if greater, I move on to check whether 2 next steps are also greater than -10, if yes, I continue and record this as A, if not, i repeat this exact step. next is to execute a "do i=k until N -k-1 (the end) to see if x(i) is greater than +10 and repeat this process.


Thanks for any suggestions
 
(1) where is your first loop (k = 1 until end) to end ?
(2) rethink the Goto A-statement and Label A. Seems to me it is not needed and would create problems the way you use it.

Coding should be simple from the status you have reached.


Norbert



The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top