Why am I getting 1 as output instead of 7 ( if a is initially assigned with 12 , then a-5 should give 7) or 3 as ( if a is assigned with 8 then a-5 should give 3 ). The output remains 1 always irrespective of the value assigned to a.
int main()
{
int a = 12;
if (a = 8 && (a = a - 5))
cout << a;
else
{
//do nothing !!
}
}
Aucun commentaire:
Enregistrer un commentaire