Where to start? I'll start from the point after attaining input.
When you begin your loop, the initialisation section of the loop erases the input the user gave, replacing it with the value of 2. At this point, the input is well-known. The condition section of the loop causes the loop to end as soon as it's encountered; the loop executes once.
Next, the "
if" statement. A few notable ill-logic things are happening here. First, the condition divides "
i" by itself, which will always evaluate to zero. Therefore, your condition is always true, and the subsequent statement is executed. The statement that follows is pointless at best. This expression is a Boolean context, and means nothing outside an initialisation, and/or conditional context. There's no point in walking through this expression. Because the two last two lines do not affect program output or flow, the compiler will optimise these away, as well as the loop in which they reside, and the "
else" branch.
Once the compiler omits the said statements, you're left with this:
1 2 3 4 5 6 7 8 9
|
int main( )
{
std::cout<< "enter number""\n";
int i(0);
std::cin>>i;
return(0);
}
|
[Note: These are my initial assumptions, and may not be entirely accurate.]
Wazzak