Count words greater than 6 letters.


I am new to C++, and got this assignment in school.

I need to create program which is able to read from a textfile and
A: Count the sentences
B: Count the words
C: Count the letters
D: Count words greater than 6 letters.

I've managed my way with A, B and C but D is giving me a great deal of trouble.

This is the code I've made so far, and I've erased whatever didn't work. I am absolutely sure this could have been done more efficient, but I do not know any loopholes yet ;)

Last edited on
You'll need some extra ints:

to track how many letters there are in a word
    (reset it to zero once you find a new word), and

to count how many times the last word has greater than six letters
    (check this before resetting Bogstaver_ord to zero).

Hope this helps.
Topic archived. No new replies allowed.