From: "Cuculain" Newsgroups: comp.os.msdos.djgpp Subject: Another Newbie Question.. A Code that needs stream-lining.. Lines: 105 X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Message-ID: Date: Sun, 25 Oct 1998 03:11:09 -0800 NNTP-Posting-Host: 207.149.41.125 X-Trace: newsfeed.slurp.net 909314061 207.149.41.125 (Sun, 25 Oct 1998 05:14:21 CDT) NNTP-Posting-Date: Sun, 25 Oct 1998 05:14:21 CDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I've been tring to work on a code that, say, inputs certain numbers, and based on the number, different functions or features would be turned on or off (such as with quake/quake2 servers, like the DMFLAG=128...) 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.. Well, never mind all that.. It's late, I've been up for almost 36 hours due to work, and I can't concentrate.. Grr.. I'll just post a portion of the code and see if there's a way I could streamline this.. :) Here goes.. /*Quest.C.. Try to find what an inputted value really means..*/ #include #include int Q1, Q2, Q3, Q4, Q5, Q6, value; main() { ScreenClear(); /*why won't clrscr work!*/ ScreenSetCursor(0,0); Q1 = 0; Q2 = 0; Q3 = 0; Q4 = 0; Q5 = 0; Q6 = 0; puts("Enter an integer Value between 1 and 63: "); scanf("%d", &value); QuestValue(value, Q1, Q2, Q3, Q4, Q5, Q6); return(0); } QuestValue(value, Q1, Q2, Q3, Q4, Q5, Q6) int value, Q1, Q2, Q3, Q4, Q5, Q6; { puts("Quest Completed:\n"); if (value >= 32) { value = value - 32; Q6 = 1; } if (value >= 16) { value = value - 16; Q5 = 1; } if (value >= 8) { value = value - 8; Q4 = 1; } if (value >= 4) { value = value - 4; Q3 = 1; } if (value >= 2) { value = value - 2; Q2 = 1; } if (value >= 1) { value = value - 1; Q1 = 1; } if (Q1 == 1) puts("Quest 1 completed."); if (Q2 == 1) puts("Quest 2 completed."); if (Q3 == 1) puts("Quest 3 completed."); if (Q4 == 1) puts("Quest 4 completed."); if (Q5 == 1) puts("Quest 5 completed."); if (Q6 == 1) puts("Quest 6 completed."); return(0); } Ah-ha! That's what I was trying to ask.. Is it even possible to... sumnum = 32; count = 6; while (sumnum <> 0); if (value >=sumnum) { value = value - sumnum; Q(count) = 1; count--; } Hmm.. Now I'm dizzy, and spacy also.. Hmm..