Link to home
Start Free TrialLog in
Avatar of honeybee_nus
honeybee_nus

asked on

read input file's data in 2 parts? (file's separated by a #)

Someone help me with this(pls)! @_@
it should be fairly simple for most programmers...

let's say this is my input file:

//i want to write a program which calculates word frequency
//--------------------------------------------------------

Hello this is a test  //lines 1-3 are the lines i want to read
This appears three times in this test
some words contain digits such as 10mar 2003
#                    // this works like a divider -- below are some words to calc freq
This                 // find the word frequency of "This"
test                 // find the word frequency of "test"
10mar                // find the word frequency of "10mar"
2003                 // find the word frequency of "2003"

//end of file
//--------------------------------------------------------------
Sample output:
THIS:3
TEST:2
10MAR:1
2003:1

------------------------------------------------------
Now how can I read only the top part and not count the word frequency in the bottom part?
Example: By right, "this" only appears 3 times, but I'm unable to write the code such that it skips counting the bottom "this" as well. Can someone teach me with the code to do this?
ASKER CERTIFIED SOLUTION
Avatar of makas
makas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Venci75
Venci75

homework?
honeybee_nus:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
Avatar of girionis
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to makas

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer