Hi macs,
Does it compile? If not post the compiler output.
If so, have you used the debugger in your IDE?
If you don't want to, or are unable to use the debugger, then put lots of couts everywhere to track the values of your variables. This is the same as "watching" in the deugger.
Find out what the getline function does and what value it returns.
Are size and arraySize actually used for anything?
Be really careful with for loops with no end condition - might be better with a while loop.
Also there are advantages in what names you use for variables, it might not seem to be a problem now, but it can save you when you get to longer more complex programs. Could line[] be better as LineArray[], and would word[] be better as WordsArray[] or WordsList. line[] and word[] imply that there is only one of them, and could be confusing. They are not technically lists, but you need a name that better describes what the variable holds. Perhaps index could be LineCounter.
IS this the correct use of the duck variable?
|
if (word[index] == duck) duckCount++;
|
Finally don't use:
IF you are using only cout, cin and string, then do this instead:
1 2 3 4
|
using std::cout;
using std::cin;
using std::string;
|
Let us know how you get on.
Cheers TheIdeasMan