Moi il y en a deux qui me résistent et j'aimerais bien qu'on m'explique :
Evaluate the following:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);
Réponse : 11
En faisant 3 fois le calcul je trouve à chaque fois 12 :D !
Et encore pire :
What is the output of the following code:
int v()
{
int m=0;
return m++;
}
int main()
{
cout<<v();
}
Réponse 0. Je comprends pas, il doit y avoir un détail qui m'échappe.