Re: zipcode selection sort in MR&C
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: zipcode selection sort in MR&C         

Group: comp.lang.fortran · Group Profile
Author: Ron Ford
Date: Aug 19, 2008 18:53

On Tue, 19 Aug 2008 18:06:12 -0800, glen herrmannsfeldt posted:
> Ron Ford wrote:
> (snip)
>
>> read (2, '(/a/a/a2,i8)',end=10) data_array(i)
>
> I don't think this format can read the file the
> way you want it read.
>
> To start, the initial / will skip the first line.

Alright, so I ace the initial backslash.
>
> Next, you should have four A descriptors
> to match the four CHARACTER variables.
>
> Third, the third A will read in the city, state, and zip
> leaving nothing when it gets to reading the zip in I8 format.
>
> The read will fail and on most systems will print a
> message telling you that it failed.
>
>> Addresses.txt is exactly:
>> T. Boone Pickens
>> 350 Swiftboat Lane
>> Houston, TX 45536
>>
>> Ev Bayh
>> 1016 Humdity Bath
>> Indianapolis, IN 47250
>>
>> Cindy McCain
>> 1000 Richie Rich
>> Scottsdale, AZ 85250
>>
>> Diane Feinstein
>> 250 Harvey Milk Circle
>> San Fransisco, CA 96580
>>
>> Tim Pawlenty
>> 500 Olson way
>> St. Paul, MN 56674
>>
>> Donald Trump
>> 100 Trump Plaza
>> New York, NY 10080
>>
>> Output.txt is:
>>
>> after sorting
>> 99 0
>
> -- glen

The read should read:
read (2, '(a/a/a/a2,i8)',end=10) data_array(i)
?

What if Donald Trump places another monument to his galactic ego by placing
'Trump' in a couple more places:
>> Donald Trump
>> 100 Trump Plaza trump
>> New trump York, NY 10080

?

--
We must be willing to pay a price for freedom. 4
H. L. Mencken
no comments
diggit! del.icio.us! reddit!