I/O Streams and Data Files

Jul 26, 2012 at 6:37pm
Hi i was wondering if there was a method to count the number of times a certain word is encounter in a data file. For example, if i had the following data file

weight
min
max
mean
weight
min
max
alpha
slope
weight
min
max
sigma
weight

so in this data file there is 4 lines that read "weight". How can i save this value 4 in a variable?


thank you
Jul 26, 2012 at 6:53pm
std::count from the header <algorithm>
Topic archived. No new replies allowed.