In the following code I get 2 errors to which I don't find any sense, I hope you can help me.
int CPartit::PuntuaCistella(ETir tir)
{
if(tir == e_lliure)
{
return 1;
}else if(tir == e_camp ){
return 2;
}else(tir==e_triple ){ //expected ';' before '{' token
return 3;
}
} //control reaches end of non-void function [-Wreturn-type]
Thank you
else
It does not admit conditions of any kind. The syntax is:In your case you are concatenating two
if-else
, so they should look like this:Note that the latter
else
has no conditions. Applied this to your code it would look like this:The second error that you mention is closely related to this one that I am telling you about. What happens is that the compiler is understanding it
(tir==e_triple) { return 3; }
as a function and of course, it comes across a badly constructed function and that the main function has a route that does not return any value.