Mail Archives: djgpp/1998/10/25/09:34:41
Cuculain wrote:
>
> Anyways, I think I got the right idea, however, as I posted before, I'm new
> to C/C++, and well, I'm not sure if I could use a portion of an array as a
> variable..
You really need to go back and fight your way through that book on C.
Try the
following snippet, (which i hope i cut 'n' pasted right this time). If
you really
need a bunch of global Q values, you could use int Q[6], and put the
line,
Q[i-1] = 1;
in QuestValue. see your book for why its 'i-1', what '&' means, and just
what
'<<=' is doing.
void QuestValue(int value) {
int mask = 1;
int i;
printf("value = %d\n", value);
for (i=1; i<7; i++) {
if (value & mask)
printf("Quest %d completed\n", i);
mask <<= 1;
}
}
- Raw text -