Click here to Skip to main content
15,920,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralActiveX control problem please help Pin
rdeekonda15-Mar-05 19:12
rdeekonda15-Mar-05 19:12 
GeneralRead Params in ActiveX Pin
DharmendraNathW15-Mar-05 19:12
DharmendraNathW15-Mar-05 19:12 
GeneralHi Everyone Pin
Rassul Yunussov15-Mar-05 18:14
Rassul Yunussov15-Mar-05 18:14 
GeneralRe: Hi Everyone Pin
John R. Shaw16-Mar-05 12:34
John R. Shaw16-Mar-05 12:34 
GeneralCrossWord puzzle alogrithm Pin
Mohsen Saad15-Mar-05 18:02
Mohsen Saad15-Mar-05 18:02 
GeneralRe: CrossWord puzzle alogrithm Pin
Ravi Bhavnani16-Mar-05 3:39
professionalRavi Bhavnani16-Mar-05 3:39 
GeneralTHE USE OF "cout statement inside the for loop" Pin
phijophlip15-Mar-05 17:56
phijophlip15-Mar-05 17:56 
GeneralRe: THE USE OF "cout statement inside the for loop" Pin
Serge Krynine15-Mar-05 18:54
Serge Krynine15-Mar-05 18:54 
1. Yes it is possible to use cout inside the for loop.
2. The fragments are not the same: the first one prints 1 through 11 with a new line at the end; the second prints 0 through 10.
3. The pseudo code for the ‘for’ loop:

for (expression1; expression2; expression3)
{
Body;
}

is somewhat like this:

EXECUTE expression1;
LABEL1:
IF expression2 is FALSE GOTO LABEL2
EXECUTE Body;
EXECUTE Eexpression3
GOTO LABEL1
LABEL2:

This pseudo code should answer why the fragments do not provide the same results. Note that the 1st fragment has an empty body.


4. From CPU usage point of view, the 1st one executes 11 'cout << i' operations and 12 times flushes the buffer (‘cout << endl’), whereas the 2nd one - 11 and 11 respectively, so the second one is faster.
5. From the code size point of view, the 2nd one is smaller as it contains 2 cout calls, whereas the 1st one – 3.
6. It is hard to say about advantages as the two are not equivalent from the point of view of producing the result.

Serge

GeneralRe: THE USE OF "cout statement inside the for loop" Pin
namaskaaram15-Mar-05 18:59
namaskaaram15-Mar-05 18:59 
General(modified) THE USE OF "cout statement inside the for loop" Pin
normanS15-Mar-05 19:12
normanS15-Mar-05 19:12 
GeneralRe: THE USE OF "cout statement inside the for loop" Pin
David Crow16-Mar-05 3:09
David Crow16-Mar-05 3:09 
GeneralNeed Help for writing event log with more than one parameter Pin
Amy Yang15-Mar-05 17:41
Amy Yang15-Mar-05 17:41 
GeneralRe: Need Help for writing event log with more than one parameter Pin
David Crow16-Mar-05 3:28
David Crow16-Mar-05 3:28 
GeneralRe: Need Help for writing event log with more than one parameter Pin
Amy Yang16-Mar-05 3:49
Amy Yang16-Mar-05 3:49 
GeneralRe: Need Help for writing event log with more than one parameter Pin
David Crow16-Mar-05 3:57
David Crow16-Mar-05 3:57 
GeneralRe: Need Help for writing event log with more than one parameter Pin
cmk16-Mar-05 16:45
cmk16-Mar-05 16:45 
GeneralRe: Need Help for writing event log with more than one parameter Pin
Amy Yang16-Mar-05 17:54
Amy Yang16-Mar-05 17:54 
GeneralMax Range For Some Constants Pin
IceBerG7115-Mar-05 16:02
IceBerG7115-Mar-05 16:02 
GeneralRe: Max Range For Some Constants Pin
Serge Krynine15-Mar-05 16:22
Serge Krynine15-Mar-05 16:22 
GeneralAbort capture screen Pin
Jack.Fu15-Mar-05 15:06
Jack.Fu15-Mar-05 15:06 
GeneralRe: Abort capture screen Pin
Christian Graus15-Mar-05 15:21
protectorChristian Graus15-Mar-05 15:21 
GeneralRe: Abort capture screen Pin
FlyingTinman15-Mar-05 15:53
FlyingTinman15-Mar-05 15:53 
GeneralRe: Abort capture screen Pin
Member 161799927-May-05 7:13
Member 161799927-May-05 7:13 
GeneralRe: Abort capture screen Pin
FlyingTinman27-May-05 8:18
FlyingTinman27-May-05 8:18 
QuestionHow to get a pixel's RGB value. Pin
Francis Chau15-Mar-05 14:41
Francis Chau15-Mar-05 14:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.