JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
csHjavaA-2019
about this document
revision
traverse and process
standard algorithms
Parallel Arrays
read text files
write text files
CSV files
Letter frequency
development workflow
indices
More
Share
Explore
read text files
Scottish voters
read a text file, store as integer values, find max, count occurrences
@
council voters
(number values in a text file)
145832
\n
192269
\n
86548
\n
65512
\n
343748
(EndOfFile)
The key file operations are required:
open
a file
read
from a file
close
a file
Examine the
text file
, it contains the
number of voters
in all 32 Scottish Councils.
Each number is displayed on a
new line
.
Examine the
code
.
Compare the code with the description in
codeClips
.
Make sure you know what code is used to
open
,
read
and
close
the file.
Challenges
What is the
largest
number of voters?
How many councils have more than 100000 voters?
Loading…
Challenges
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.