Be aware that, for a "while" loop, you need either:
while(condition) { statement1; statemen2; ...; staementN; }
...or:
do { statement1; statemen2; ...; staementN; } while(condition);
So, in the code you have posted, you actually have:
1 2 3 4 5
|
do { //line #13
//housekeeping()
[...]
}
while (votes >= 1); //line #41
|
The many linebreaks you put before the
while() in line #41 are irrelevant for the C compiler ;-)
The code in line #42 and line #47 is executed
unconditionally.
Furthermore, this code in line #32 is a "while" loop which does absolutely
nothing in its body:
while (rating > -1);
(...but still checks the condition, so potentially hangs in an infinite loop)
For an "if" statement you need:
if(condition) { statement1; statemen2; ...; staementN; }
Note: There
must not be a semicolon immediately after the "if" condition, because otherwise the code translates to "
if condition then nothing", and the code in curly braces is executed unconditionally ;-)
I
much recommend you increase the
warning level of your C compiler to the maximum, because most of the problems in your code should have triggered a warning. If there are any warnings, do
not ignore them!