So my code does not compile because it does not return a value. I don't know how to make it work and return true and false as it is in the if statement
// Update vote totals given a new vote
bool vote(string name)
{
// Iterate over candidates
for (int i = 0; i < candidate_count; i++)
{
// If found update vote total and return true
if (strcmp(name, candidates[i].name) != 0)
{
candidates[i].votes++;
return true;
}
// Else if no candidate is called name return false
else
{
return false;
}
}
}
If anyone can give me directions or a link where I can find more information about this I would be very grateful.