Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Question: lines of numbers separated with empty lines
Hi there,

I have the following problem:

I have lines with numbers; every several lines, the numbers are
separated with 2 empty lines. How can I count the # of lines
with numbers between 2 separations?

For example

1 2
2 3             4 lines here
3 4
4 5


1 2              2 lines here
5 6


2 3
3 4              3 lines here
4 5

Thank you!

/PS


Report this thread to moderator Post Follow-up to this message
Old Post
peter_smith_yh@yahoo.com
12-18-04 08:56 PM


Re: Question: lines of numbers separated with empty lines
The following program counts the number of non-blank lines between
blank lines. You could modify it to check that non-blank lines contain
two integers. Google Groups seems to mess up the indentation.

program xread
implicit none
integer                      :: ierr,nnum
integer, parameter           :: in_unit=20
character (len=100)          :: text
character (len=*), parameter :: in_file="read_test.dat"
open (unit=in_unit,file=in_file,action="read",status="old")
nnum = 0
do
read (in_unit,"(a)",iostat=ierr) text
if (ierr /= 0) then
print*,nnum
exit
end if
if (text == "") then
if (nnum > 0) print*,nnum
nnum = 0
else
nnum = nnum + 1
end if
end do
end program xread

output:
4
2
3


Report this thread to moderator Post Follow-up to this message
Old Post
beliavsky@aol.com
12-18-04 08:56 PM


Re: Question: lines of numbers separated with empty lines
Thanks - it works fine!


Report this thread to moderator Post Follow-up to this message
Old Post
peter_smith_yh@yahoo.com
12-19-04 01:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:00 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.