Oct 15, 2011 at 4:31pm UTC
In this program:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{int a = 750;
if (a > 0)
if (a>=1000)
a=0;
else
a *= 2;
else
a *=10;
return (0) ;
}
would the memory snapshot be a=0?
Oct 15, 2011 at 9:01pm UTC
Hey, your program doesn't make much sense.
Like, the two if's basically are &&. Like, if a is greater than 0 and if a is greater than 1000 or equals to 1000.
With it like this, then EVERY POSITIVE WHOLE NUMBER including 0 would turn the value a to 0.
I mean it does make sense but I don't think you intend it that way?
I think you may of intended t make it Between 0 and up to 1000. I don't know. But yeah, just in case; was to let u know.