According to the program below, if donuts = 1
it will assign 0
to donuts
, but if I run this it shows that 0
is assigned to donuts
. Please tell me what I am over looking. Because how I see this code donuts should equal 12
, because donuts should have fallen into the else:
#include <iostream> // Header file to enable console I/O
#include <string> // Header file to enable string
#include <iomanip> // enables maniplution of io strem
using namespace std;
// Begin main Function Definition
int main()
{
int donuts = 10;
if (donuts = 1)
{
donuts = 0;
}
else
{
donuts += 2;
}
cout<< donuts;
system("PAUSE");
return 0;
}
// End of main function