While Loop Question
Posted on 2006-11-26
I have a simple question but I couldnt figure it out whats going on...
I have a piece of code like
cout<<"After loop k="<<k;
The printed values are 1,2,3,4,5,6,7,8,9,10,11
and after the loop the value of k is 12.
How does C++ test the expression? Does it increase the value of k then test the expression or does it first test then increase the value of k
if you add QuickWatch for expressions k++<=10 and k the output is 3,6,9,12 and after loop the value of k=15
What is going on?
By the way I am using Microsoft Visual Studio.NET