I'm currently trying to do cs50 pset3 plurality problem and I have unfortunately ran into this error which I do not know how to overcome. The error is "non-void function does not return a value in all control paths error" and refers to this particular section of code where it refers to the last } of the code.
If you need the preceding lines of code do tell me I will post it. Your help is very much appreciated thank you!
bool vote(string name)
{
for (int a = 0 ; a < candidate_count ; a++)
{
//if input name matches any name in candidate list
if (strcmp(name, candidates[a].name) == 0)
{
return true;
}
//if input name does not match with any name
else
{
return false;
}
}
}