There are many good articles about drawing in mfc - which is really pretty much Win32. Rather than have that magical moment where you get it running and it flickers constantly, make sure to look into double buffering with a bitmap.
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
You may use either the legacy rand()[^] function (with the srand one you might provide the seed), or the classes provided by the 'new' random header[^]. The latter is more sophisticated and has a somewhat more difficult interface. You might look at code samples, though, for instance, see the code in this page[^].
Using return where you do, exits the current function you are in, in this case it is main(). So you are exiting the program when you call return.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
This is something I hate, but it's idiomatic. A C string ends with the character NUL, whose ASCII value is 0, which is equivalent to false. So the loop ends when the character NUL (usually written as '\0') is encountered. The check is equivalent to
name[i] != '\0'
but some people hate typing so much that they write this kind of thing.
The for statement breaks down as three individual expressions:
for(set; while; do) :
//// set : perform this or these expressions first: multiple expressions must be separated by commas// while : repeat the loop while this expression equates to true// do : perform this or these expressions at the end of each loop
Note that any of these expressions (or indeed all of them) may be blank.
In your code the expression in the while part is name[i], which means while name[i] is true, or rather while name[i] is not equal to zero. Strings in C are (or should be) terminated with a zero character (NULL), so the expression will be true as long as the character in question is not the terminating NULL.
Sure, as a pointer to that element (&array[i]) or as a reference (array[i]). This is assuming you want access to the actual element, not a copy. If it's an array of int, the receiving arguments would have the types int* and int&, respectively.