Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: how to read and write a file use unicode in windows 98?? Pin
David Crow26-Jan-06 2:27
David Crow26-Jan-06 2:27 
Questionhow does this for loop work! Pin
namaskaaram24-Jan-06 23:21
namaskaaram24-Jan-06 23:21 
AnswerRe: how does this for loop work! Pin
benjymous24-Jan-06 23:31
benjymous24-Jan-06 23:31 
GeneralRe: how does this for loop work! Pin
Trollslayer25-Jan-06 1:42
mentorTrollslayer25-Jan-06 1:42 
AnswerRe: how does this for loop work! Pin
Owner drawn24-Jan-06 23:32
Owner drawn24-Jan-06 23:32 
AnswerRe: how does this for loop work! Pin
Rage24-Jan-06 23:43
professionalRage24-Jan-06 23:43 
GeneralRe: how does this for loop work! Pin
toxcct25-Jan-06 0:09
toxcct25-Jan-06 0:09 
AnswerRe: how does this for loop work! Pin
Rage25-Jan-06 0:03
professionalRage25-Jan-06 0:03 
More as promised:

namaskaaram wrote:
a="- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21];


for each step in this for loop:

1. b is increased by one in [b+++21], so you basically do b=10, b=11, b=12, and so on.

2. a is initialised to the value of the char placed in position b+21 as stated in [b+++21] in the map string.

3. the second for loop is executed. Let's have a closer look:

++c=='Z' ? c = c/ 9:33^b&1


this is equivalent to

if (c==30)
 putchar(c=c/9); // carriage return (next line to display)
else
 putchar(33^b&1);// displays space or !
c++;


following happens in the for loop

3a. a is decreased by one, meaning you stay in this loop (a-64) times
3b. c is increased. If c is equal to 'Z'(=30), a return to carriage is printed, since ++c=='Z' ? c = c/ 9:33^b&1 returns c = c/9, and this is 10.
3c. otherwise, you return 33 Xored with b&1 which is either a space or a '!' char, which prints the map.

when the index b+21 exceeds the string length, the assignement a = string[b+21]is false, leaving the first for loop.

and finally, int count = 1; is of no use Smile | :)

Hope this helps.





~RaGE();

-- modified at 6:03 Wednesday 25th January, 2006
GeneralRe: how does this for loop work! Pin
David Crow25-Jan-06 4:12
David Crow25-Jan-06 4:12 
AnswerWhat it actually means... ! Pin
toxcct25-Jan-06 0:43
toxcct25-Jan-06 0:43 
GeneralRe: What it actually means... ! Pin
Eytukan25-Jan-06 2:32
Eytukan25-Jan-06 2:32 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 2:34
toxcct25-Jan-06 2:34 
GeneralRe: What it actually means... ! Pin
Chris Losinger25-Jan-06 4:50
professionalChris Losinger25-Jan-06 4:50 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 4:54
toxcct25-Jan-06 4:54 
General[Message Deleted] Pin
Chris Losinger25-Jan-06 5:02
professionalChris Losinger25-Jan-06 5:02 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 5:04
toxcct25-Jan-06 5:04 
GeneralRe: What it actually means... ! Pin
Chris Losinger25-Jan-06 5:13
professionalChris Losinger25-Jan-06 5:13 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 6:12
toxcct25-Jan-06 6:12 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 6:46
toxcct25-Jan-06 6:46 
GeneralRe: What it actually means... ! Pin
Chris Losinger25-Jan-06 7:02
professionalChris Losinger25-Jan-06 7:02 
GeneralRe: What it actually means... ! Pin
toxcct25-Jan-06 7:04
toxcct25-Jan-06 7:04 
GeneralRe: What it actually means... ! Pin
Chris Losinger25-Jan-06 7:09
professionalChris Losinger25-Jan-06 7:09 
GeneralRe: What it actually means... ! Pin
sunit525-Jan-06 7:14
sunit525-Jan-06 7:14 
GeneralRe: What it actually means... ! Pin
BadKarma25-Jan-06 20:42
BadKarma25-Jan-06 20:42 
GeneralRe: What it actually means... ! Pin
toxcct26-Jan-06 3:10
toxcct26-Jan-06 3:10 

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.