in reply to I need your HELP!!
The first program you should write is:
The second program you should write is:## open data file ## slurp in lines from data file ## foreach your way through the data ## print lines back to verify it was slurped.
The third program you should write is:## open data file ## slurp in lines from data file ## foreach your way through the data ## parse the line into two scalars ## print the two scalars to verify parsing.
The fourth program you should write is:## open data file ## slurp in lines from data file ## foreach your way through the data ## parse the line into two scalars ## stuff the two scalars into two arrays ## print the two arrays to verify stuffing.
This is what I call sneaking up on the project -- step by step.## open data file ## slurp in lines from data file ## foreach your way through the data ## parse the line into two scalars ## stuff the two scalars into two arrays ## sum all grades ## print the sum ## count the number of grades ## print the number of grades ## calculate the averate ## print the average
Later you can go back into the final program and remove unnecessary 'inbetween' variables and do general clean up.
For the moment your questions may resolve around simple things like: "How in the heck do I 'slurp' (a.k.a. read in) a file?" or such things as: "How do I step through a file line by line?"
Good luck.
Claude
p.s. Individual tastes will vary when it comes to selecting which baby steps to take in sneaking up on a program.
In general you can bet that trying to do it all at once will introduce too many problems and bugs to deal with.
|
|---|