Quote:
I have code like this right now, but it doesnt work at all.
Well, no. It won't.
It won't even compile, much less run or do anything useful.
Throw that lot away, and start again from scratch.
Do it in "easy stages".
Write a function to find the first 0 value, and return it's index.
When that works, change it to find the first and second zero value.
When that works, add the code to sum the values between them.
But ... this is your homework, so I'll give you no code: it simple enough that if you do it in easy stages and think before you start code each time, you will do it in very little time at all.